mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
Color blind themes (#3322)
* Add themes for deuteranopia, protanopia, and tritanopia
This commit is contained in:
@@ -24,7 +24,7 @@ this.BLOCKLY_BOOT = function(root) {
|
||||
goog.addDependency("../../core/block.js", ['Blockly.Block'], ['Blockly.Blocks', 'Blockly.Connection', 'Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Extensions', 'Blockly.Input', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.colour', 'Blockly.utils.object', 'Blockly.fieldRegistry', 'Blockly.utils.string', 'Blockly.Workspace']);
|
||||
goog.addDependency("../../core/block_animations.js", ['Blockly.blockAnimations'], ['Blockly.utils.dom']);
|
||||
goog.addDependency("../../core/block_drag_surface.js", ['Blockly.BlockDragSurfaceSvg'], ['Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']);
|
||||
goog.addDependency("../../core/block_dragger.js", ['Blockly.BlockDragger'], ['Blockly.blockAnimations', 'Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.InsertionMarkerManager', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']);
|
||||
goog.addDependency("../../core/block_dragger.js", ['Blockly.BlockDragger'], ['Blockly.blockAnimations', 'Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.Events.Ui', 'Blockly.InsertionMarkerManager', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']);
|
||||
goog.addDependency("../../core/block_events.js", ['Blockly.Events.BlockBase', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Events.Change', 'Blockly.Events.Create', 'Blockly.Events.Delete', 'Blockly.Events.Move'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.utils.Coordinate', 'Blockly.utils.object', 'Blockly.utils.xml']);
|
||||
goog.addDependency("../../core/block_svg.js", ['Blockly.BlockSvg'], ['Blockly.Block', 'Blockly.blockAnimations', 'Blockly.blockRendering.IPathObject', 'Blockly.ContextMenu', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.Events.BlockMove', 'Blockly.Msg', 'Blockly.RenderedConnection', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Rect', 'Blockly.Warning']);
|
||||
goog.addDependency("../../core/blockly.js", ['Blockly'], ['Blockly.constants', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.inject', 'Blockly.navigation', 'Blockly.Procedures', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.utils', 'Blockly.utils.colour', 'Blockly.Variables', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.Xml']);
|
||||
@@ -39,7 +39,7 @@ goog.addDependency("../../core/components/tree/basenode.js", ['Blockly.tree.Base
|
||||
goog.addDependency("../../core/components/tree/treecontrol.js", ['Blockly.tree.TreeControl'], ['Blockly.tree.TreeNode', 'Blockly.tree.BaseNode', 'Blockly.utils.aria', 'Blockly.utils.object', 'Blockly.utils.style']);
|
||||
goog.addDependency("../../core/components/tree/treenode.js", ['Blockly.tree.TreeNode'], ['Blockly.tree.BaseNode', 'Blockly.utils.object', 'Blockly.utils.KeyCodes']);
|
||||
goog.addDependency("../../core/connection.js", ['Blockly.Connection'], ['Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.Xml']);
|
||||
goog.addDependency("../../core/connection_db.js", ['Blockly.ConnectionDB'], ['Blockly.Connection']);
|
||||
goog.addDependency("../../core/connection_db.js", ['Blockly.ConnectionDB'], ['Blockly.RenderedConnection']);
|
||||
goog.addDependency("../../core/constants.js", ['Blockly.constants'], []);
|
||||
goog.addDependency("../../core/contextmenu.js", ['Blockly.ContextMenu'], ['Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.Msg', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.uiMenu', 'Blockly.utils.userAgent', 'Blockly.Xml']);
|
||||
goog.addDependency("../../core/css.js", ['Blockly.Css'], []);
|
||||
@@ -52,12 +52,12 @@ goog.addDependency("../../core/field_angle.js", ['Blockly.FieldAngle'], ['Blockl
|
||||
goog.addDependency("../../core/field_checkbox.js", ['Blockly.FieldCheckbox'], ['Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Size']);
|
||||
goog.addDependency("../../core/field_colour.js", ['Blockly.FieldColour'], ['Blockly.Css', 'Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.navigation', 'Blockly.utils.aria', 'Blockly.utils.colour', 'Blockly.utils.dom', 'Blockly.utils.IdGenerator', 'Blockly.utils.KeyCodes', 'Blockly.utils.object', 'Blockly.utils.Size']);
|
||||
goog.addDependency("../../core/field_date.js", ['Blockly.FieldDate'], ['Blockly.Css', 'Blockly.Events', 'Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.string', 'goog.date', 'goog.date.DateTime', 'goog.events', 'goog.i18n.DateTimeSymbols', 'goog.i18n.DateTimeSymbols_he', 'goog.ui.DatePicker']);
|
||||
goog.addDependency("../../core/field_dropdown.js", ['Blockly.FieldDropdown'], ['Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.navigation', 'Blockly.utils', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Size', 'Blockly.utils.string', 'Blockly.utils.userAgent']);
|
||||
goog.addDependency("../../core/field_dropdown.js", ['Blockly.FieldDropdown'], ['Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.navigation', 'Blockly.utils', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Size', 'Blockly.utils.string', 'Blockly.utils.userAgent']);
|
||||
goog.addDependency("../../core/field_image.js", ['Blockly.FieldImage'], ['Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.utils', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Size']);
|
||||
goog.addDependency("../../core/field_label.js", ['Blockly.FieldLabel'], ['Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.utils', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Size']);
|
||||
goog.addDependency("../../core/field_label_serializable.js", ['Blockly.FieldLabelSerializable'], ['Blockly.FieldLabel', 'Blockly.fieldRegistry', 'Blockly.utils', 'Blockly.utils.object']);
|
||||
goog.addDependency("../../core/field_multilineinput.js", ['Blockly.FieldMultilineInput'], ['Blockly.Css', 'Blockly.DropDownDiv', 'Blockly.FieldTextInput', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.KeyCodes', 'Blockly.utils.object', 'Blockly.utils.userAgent']);
|
||||
goog.addDependency("../../core/field_number.js", ['Blockly.FieldNumber'], ['Blockly.fieldRegistry', 'Blockly.FieldTextInput', 'Blockly.utils.object']);
|
||||
goog.addDependency("../../core/field_multilineinput.js", ['Blockly.FieldMultilineInput'], ['Blockly.Css', 'Blockly.DropDownDiv', 'Blockly.FieldTextInput', 'Blockly.utils', 'Blockly.utils.aria', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.KeyCodes', 'Blockly.utils.object', 'Blockly.utils.userAgent']);
|
||||
goog.addDependency("../../core/field_number.js", ['Blockly.FieldNumber'], ['Blockly.fieldRegistry', 'Blockly.FieldTextInput', 'Blockly.utils.aria', 'Blockly.utils.object']);
|
||||
goog.addDependency("../../core/field_registry.js", ['Blockly.fieldRegistry'], []);
|
||||
goog.addDependency("../../core/field_textinput.js", ['Blockly.FieldTextInput'], ['Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.fieldRegistry', 'Blockly.Msg', 'Blockly.utils', 'Blockly.utils.aria', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.KeyCodes', 'Blockly.utils.object', 'Blockly.utils.Size', 'Blockly.utils.userAgent']);
|
||||
goog.addDependency("../../core/field_variable.js", ['Blockly.FieldVariable'], ['Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.FieldDropdown', 'Blockly.fieldRegistry', 'Blockly.Msg', 'Blockly.utils', 'Blockly.utils.object', 'Blockly.utils.Size', 'Blockly.VariableModel', 'Blockly.Variables', 'Blockly.Xml']);
|
||||
@@ -119,13 +119,15 @@ goog.addDependency("../../core/renderers/zelos/drawer.js", ['Blockly.zelos.Drawe
|
||||
goog.addDependency("../../core/renderers/zelos/info.js", ['Blockly.zelos', 'Blockly.zelos.RenderInfo'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.RoundCorner', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SquareCorner', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.StatementInput', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.utils.object', 'Blockly.zelos.AfterStatementSpacerRow', 'Blockly.zelos.BeforeStatementSpacerRow', 'Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow']);
|
||||
goog.addDependency("../../core/renderers/zelos/measurables/rows.js", ['Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow', 'Blockly.zelos.AfterStatementSpacerRow', 'Blockly.zelos.BeforeStatementSpacerRow'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.SpacerRow', 'Blockly.utils.object']);
|
||||
goog.addDependency("../../core/renderers/zelos/renderer.js", ['Blockly.zelos.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.RenderInfo']);
|
||||
goog.addDependency("../../core/requires.js", ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.HorizontalFlyout', 'Blockly.VerticalFlyout', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.ZoomControls', 'Blockly.Mutator', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldLabelSerializable', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.geras.Renderer', 'Blockly.Themes.Classic', 'Blockly.Themes.Dark', 'Blockly.Themes.HighContrast', 'Blockly.Themes.Modern']);
|
||||
goog.addDependency("../../core/requires.js", ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.HorizontalFlyout', 'Blockly.VerticalFlyout', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.ZoomControls', 'Blockly.Mutator', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldLabelSerializable', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.geras.Renderer', 'Blockly.Themes.Classic', 'Blockly.Themes.Dark', 'Blockly.Themes.Deuteranopia', 'Blockly.Themes.HighContrast', 'Blockly.Themes.Tritanopia']);
|
||||
goog.addDependency("../../core/scrollbar.js", ['Blockly.Scrollbar', 'Blockly.ScrollbarPair'], ['Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']);
|
||||
goog.addDependency("../../core/theme.js", ['Blockly.Theme'], []);
|
||||
goog.addDependency("../../core/theme/classic.js", ['Blockly.Themes.Classic'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/theme/dark.js", ['Blockly.Themes.Dark'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/theme/deuteranopia.js", ['Blockly.Themes.Deuteranopia'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/theme/highcontrast.js", ['Blockly.Themes.HighContrast'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/theme/modern.js", ['Blockly.Themes.Modern'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/theme/tritanopia.js", ['Blockly.Themes.Tritanopia'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/theme_manager.js", ['Blockly.ThemeManager'], ['Blockly.Theme']);
|
||||
goog.addDependency("../../core/toolbox.js", ['Blockly.Toolbox'], ['Blockly.Css', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.navigation', 'Blockly.Touch', 'Blockly.tree.TreeControl', 'Blockly.tree.TreeNode', 'Blockly.utils', 'Blockly.utils.aria', 'Blockly.utils.colour', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Rect']);
|
||||
goog.addDependency("../../core/tooltip.js", ['Blockly.Tooltip'], ['Blockly.utils.string']);
|
||||
@@ -165,7 +167,7 @@ goog.addDependency("../../core/workspace_comment_render_svg.js", ['Blockly.Works
|
||||
goog.addDependency("../../core/workspace_comment_svg.js", ['Blockly.WorkspaceCommentSvg'], ['Blockly.Events', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.Events.Ui', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Rect', 'Blockly.WorkspaceComment']);
|
||||
goog.addDependency("../../core/workspace_drag_surface_svg.js", ['Blockly.WorkspaceDragSurfaceSvg'], ['Blockly.utils', 'Blockly.utils.dom']);
|
||||
goog.addDependency("../../core/workspace_dragger.js", ['Blockly.WorkspaceDragger'], ['Blockly.utils.Coordinate']);
|
||||
goog.addDependency("../../core/workspace_events.js", ['Blockly.Events.FinishedLoading'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.utils.object']);
|
||||
goog.addDependency("../../core/workspace_events.js", ['Blockly.Events.FinishedLoading'], ['Blockly.Events', 'Blockly.Events.Ui', 'Blockly.utils.object']);
|
||||
goog.addDependency("../../core/workspace_svg.js", ['Blockly.WorkspaceSvg'], ['Blockly.BlockSvg', 'Blockly.blockRendering', 'Blockly.ConnectionDB', 'Blockly.constants', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Gesture', 'Blockly.Grid', 'Blockly.Msg', 'Blockly.Options', 'Blockly.TouchGesture', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.Rect', 'Blockly.Workspace', 'Blockly.WorkspaceAudio', 'Blockly.WorkspaceDragSurfaceSvg', 'Blockly.Xml']);
|
||||
goog.addDependency("../../core/ws_comment_events.js", ['Blockly.Events.CommentBase', 'Blockly.Events.CommentChange', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.utils.Coordinate', 'Blockly.utils.object', 'Blockly.utils.xml']);
|
||||
goog.addDependency("../../core/xml.js", ['Blockly.Xml'], ['Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.FinishedLoading', 'Blockly.Events.VarCreate', 'Blockly.utils', 'Blockly.utils.dom', 'Blockly.utils.global', 'Blockly.utils.xml']);
|
||||
|
||||
@@ -88,5 +88,7 @@ goog.require('Blockly.geras.Renderer');
|
||||
// Classic is the default theme.
|
||||
goog.require('Blockly.Themes.Classic');
|
||||
goog.require('Blockly.Themes.Dark');
|
||||
goog.require('Blockly.Themes.Deuteranopia');
|
||||
goog.require('Blockly.Themes.HighContrast');
|
||||
goog.require('Blockly.Themes.Modern');
|
||||
goog.require('Blockly.Themes.Tritanopia');
|
||||
// goog.require('Blockly.Themes.Modern');
|
||||
|
||||
114
core/theme/deuteranopia.js
Normal file
114
core/theme/deuteranopia.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Deuteranopia theme.
|
||||
* A color palette for people that have deuteranopia(the inability to perceive
|
||||
* green light). This can also be used for people that have protanopia(the
|
||||
* inability to perceive red light).
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Themes.Deuteranopia');
|
||||
|
||||
goog.require('Blockly.Theme');
|
||||
|
||||
|
||||
// Temporary holding object.
|
||||
Blockly.Themes.Deuteranopia = {};
|
||||
|
||||
Blockly.Themes.Deuteranopia.defaultBlockStyles = {
|
||||
"colour_blocks": {
|
||||
"colourPrimary": "#f2a72c",
|
||||
"colourSecondary": "#f1c17",
|
||||
"colourTertiary": "#da921c"
|
||||
},
|
||||
"list_blocks": {
|
||||
"colourPrimary": "#7d65ab",
|
||||
"colourSecondary": "#a88be0",
|
||||
"colourTertiary": "#66518e"
|
||||
},
|
||||
"logic_blocks": {
|
||||
"colourPrimary": "#9fd2f1",
|
||||
"colourSecondary": "#c0e0f4",
|
||||
"colourTertiary": "#74bae5"
|
||||
},
|
||||
"loop_blocks": {
|
||||
"colourPrimary": "#795a07",
|
||||
"colourSecondary": "#ac8726",
|
||||
"colourTertiary": "#c4a03f"
|
||||
},
|
||||
"math_blocks": {
|
||||
"colourPrimary": "#e6da39",
|
||||
"colourSecondary": "#f3ec8e",
|
||||
"colourTertiary": "#f2eeb7"
|
||||
},
|
||||
"procedure_blocks": {
|
||||
"colourPrimary": "#590721",
|
||||
"colourSecondary": "#8c475d",
|
||||
"colourTertiary": "#885464"
|
||||
},
|
||||
"text_blocks": {
|
||||
"colourPrimary": "#058863",
|
||||
"colourSecondary": "#5ecfaf",
|
||||
"colourTertiary": "#04684c"
|
||||
},
|
||||
"variable_blocks": {
|
||||
"colourPrimary": "#47025a",
|
||||
"colourSecondary": "#820fa1",
|
||||
"colourTertiary": "#8e579d"
|
||||
},
|
||||
"variable_dynamic_blocks": {
|
||||
"colourPrimary": "#47025a",
|
||||
"colourSecondary": "#820fa1",
|
||||
"colourTertiary": "#8e579d"
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Themes.Deuteranopia.categoryStyles = {
|
||||
"colour_category": {
|
||||
"colour": "#f2a72c"
|
||||
},
|
||||
"list_category": {
|
||||
"colour": "#7d65ab"
|
||||
},
|
||||
"logic_category": {
|
||||
"colour": "#9fd2f1"
|
||||
},
|
||||
"loop_category": {
|
||||
"colour": "#795a07"
|
||||
},
|
||||
"math_category": {
|
||||
"colour": "#e6da39"
|
||||
},
|
||||
"procedure_category": {
|
||||
"colour": "#590721"
|
||||
},
|
||||
"text_category": {
|
||||
"colour": "#058863"
|
||||
},
|
||||
"variable_category": {
|
||||
"colour": "#47025a"
|
||||
},
|
||||
"variable_dynamic_category": {
|
||||
"colour": "#47025a"
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Themes.Deuteranopia =
|
||||
new Blockly.Theme(Blockly.Themes.Deuteranopia.defaultBlockStyles,
|
||||
Blockly.Themes.Deuteranopia.categoryStyles);
|
||||
113
core/theme/tritanopia.js
Normal file
113
core/theme/tritanopia.js
Normal file
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Tritanopia theme.
|
||||
* A color palette for people that have tritanopia(the inability to perceive
|
||||
* blue light).
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Themes.Tritanopia');
|
||||
|
||||
goog.require('Blockly.Theme');
|
||||
|
||||
|
||||
// Temporary holding object.
|
||||
Blockly.Themes.Tritanopia = {};
|
||||
|
||||
Blockly.Themes.Tritanopia.defaultBlockStyles = {
|
||||
"colour_blocks": {
|
||||
"colourPrimary": "#05427f",
|
||||
"colourSecondary": "#2974c0",
|
||||
"colourTertiary": "#2d74bb"
|
||||
},
|
||||
"list_blocks": {
|
||||
"colourPrimary": "#b69ce8",
|
||||
"colourSecondary": "#ccbaef",
|
||||
"colourTertiary": "#9176c5"
|
||||
},
|
||||
"logic_blocks": {
|
||||
"colourPrimary": "#9fd2f1",
|
||||
"colourSecondary": "#c0e0f4",
|
||||
"colourTertiary": "#74bae5"
|
||||
},
|
||||
"loop_blocks": {
|
||||
"colourPrimary": "#aa1846",
|
||||
"colourSecondary": "#d36185",
|
||||
"colourTertiary": "#7c1636"
|
||||
},
|
||||
"math_blocks": {
|
||||
"colourPrimary": "#e6da39",
|
||||
"colourSecondary": "#f3ec8e",
|
||||
"colourTertiary": "#f2eeb7"
|
||||
},
|
||||
"procedure_blocks": {
|
||||
"colourPrimary": "#590721",
|
||||
"colourSecondary": "#8c475d",
|
||||
"colourTertiary": "#885464"
|
||||
},
|
||||
"text_blocks": {
|
||||
"colourPrimary": "#058863",
|
||||
"colourSecondary": "#5ecfaf",
|
||||
"colourTertiary": "#04684c"
|
||||
},
|
||||
"variable_blocks": {
|
||||
"colourPrimary": "#4b2d84",
|
||||
"colourSecondary": "#816ea7",
|
||||
"colourTertiary": "#83759e"
|
||||
},
|
||||
"variable_dynamic_blocks": {
|
||||
"colourPrimary": "#4b2d84",
|
||||
"colourSecondary": "#816ea7",
|
||||
"colourTertiary": "#83759e"
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Themes.Tritanopia.categoryStyles = {
|
||||
"colour_category": {
|
||||
"colour": "#05427f"
|
||||
},
|
||||
"list_category": {
|
||||
"colour": "#b69ce8"
|
||||
},
|
||||
"logic_category": {
|
||||
"colour": "#9fd2f1"
|
||||
},
|
||||
"loop_category": {
|
||||
"colour": "#aa1846"
|
||||
},
|
||||
"math_category": {
|
||||
"colour": "#e6da39"
|
||||
},
|
||||
"procedure_category": {
|
||||
"colour": "#590721"
|
||||
},
|
||||
"text_category": {
|
||||
"colour": "#058863"
|
||||
},
|
||||
"variable_category": {
|
||||
"colour": "#4b2d84"
|
||||
},
|
||||
"variable_dynamic_category": {
|
||||
"colour": "#4b2d84"
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.Themes.Tritanopia =
|
||||
new Blockly.Theme(Blockly.Themes.Tritanopia.defaultBlockStyles,
|
||||
Blockly.Themes.Tritanopia.categoryStyles);
|
||||
@@ -71,6 +71,7 @@
|
||||
// Custom requires for the playground.
|
||||
goog.require('Blockly.blockRendering.Debug');
|
||||
goog.require('Blockly.minimalist.Renderer');
|
||||
goog.require('Blockly.Themes.Modern');
|
||||
goog.require('Blockly.thrasos.Renderer');
|
||||
goog.require('Blockly.zelos.Renderer');
|
||||
</script>
|
||||
@@ -320,12 +321,17 @@ function addRenderDebugOptionsCheckboxes() {
|
||||
|
||||
function changeTheme() {
|
||||
var theme = document.getElementById('themeChanger');
|
||||
if (theme.value === "modern") {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.Modern);
|
||||
} else if (theme.value === "dark") {
|
||||
|
||||
if (theme.value === "dark") {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.Dark);
|
||||
} else if (theme.value === "high_contrast") {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.HighContrast);
|
||||
} else if (theme.value === "deuteranopia") {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.Deuteranopia);
|
||||
} else if (theme.value === "tritanopia") {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.Tritanopia);
|
||||
} else if (theme.value === "modern") {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.Modern);
|
||||
} else {
|
||||
Blockly.getMainWorkspace().setTheme(Blockly.Themes.Classic);
|
||||
}
|
||||
@@ -587,6 +593,8 @@ var spaghettiXml = [
|
||||
<option value="modern">Modern</option>
|
||||
<option value="dark">Dark</option>
|
||||
<option value="high_contrast">High Contrast</option>
|
||||
<option value="deuteranopia">Deuteranopia/Protanopia</option>
|
||||
<option value="tritanopia">Tritanopia</option>
|
||||
</select>
|
||||
<p>
|
||||
<input type="button" value="Export to XML" onclick="toXml()">
|
||||
|
||||
Reference in New Issue
Block a user