Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color-Style System Re-Structuring and Colorblind Accessibility #1384

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d588ad2
feat: Add color scheme selection and colorblind modes to Preferences UI
lauble Nov 14, 2023
1a85cbd
feat: Implement restructured color system
chinweibegbu Apr 12, 2024
4b9a8e2
refactor: Enable code to use the created color system
chinweibegbu Apr 12, 2024
51f6814
refactor: Remove color grouping in color scheme objects
chinweibegbu Apr 16, 2024
42d2c1d
refactor: Update styleMatch() function to use new color system
chinweibegbu Apr 16, 2024
91a22f4
perf: Add default color scheme handling
chinweibegbu Apr 17, 2024
f1dde1c
refactor: update style naming to reflect functionality
chinweibegbu Apr 19, 2024
ee9d116
feat: Re-implement high-contrast color scheme
chinweibegbu Apr 19, 2024
c1d70b3
refactor: Remove redundant colors.json file
chinweibegbu Apr 19, 2024
1cacc04
feat: Finalize three potential colorblind-friendly color schemes
chinweibegbu Apr 19, 2024
0285186
docs: Add documentation for the proposed color system re-structure
chinweibegbu Apr 19, 2024
ffa9393
docs: Add documentation for the styling system refactor
chinweibegbu Apr 23, 2024
dd711f7
feat: Hotkey for color scheme switching (ALT + SHIFT + C)
chinweibegbu Apr 27, 2024
468a851
style: Address npm test warnings and errors
chinweibegbu Apr 30, 2024
ee35a89
fix: Remove redundant combo box load function call
chinweibegbu May 1, 2024
376336c
fix: Specify "Help" screen message for color scheme switching hotkey
chinweibegbu May 4, 2024
6d87956
refactor: Update Preference panel sub-section text
chinweibegbu May 4, 2024
dcf234e
feat: Make colorblind simulators a poweruser-only feature
chinweibegbu May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
305 changes: 305 additions & 0 deletions data/README.md
Copy link
Author

@chinweibegbu chinweibegbu May 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not certain of the name and location of this file. It being called README.md in the /data/ folder implies that it describes the content of everything in that folder, which is not the case.

The file details how Rapid deals with colors and styles relative to structure. If there were a specific folder that held all information related to colors, I would have put it there. Alternatively, it could be renamed to COLORS.md or COLOR-STYLE.md.

Another thing to consider is whether documentation of this nature even meant to be in this repo in the first place. For instance, I have been informed of Rapid's Wiki pages by @Bonkles. I think it is important to keep track of the way developers are thinking about Rapid's structure but, in summary, I do not know that I am doing this in a manner that matches the current structure of Rapid.

Comments on the file content itself would be appreciated as well.

Focus: Inadequate current state [Documentation]

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions data/color_schemes.json
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current color system attempts to group and order colors in an intuitive manner. Colors are first grouped into their nearest common color name e.g. red, blue. Then, they are ordered in terms of relative brightness/lightness.

Current issues/thoughts:

  • Adding a new color which does not fall at either extreme of a particular color group's spectrum based on brightness/lightness affects every other color in its color group (see Fig. 2)

  • Updating the order of colors requires refactoring which is error-prone (see Fig. 2)

    • Potential solutions
      1. Use a placeholder key to move from the first number-wise to the last
      2. Ensure to refactor code outside color_schemes.json in the reverse number order --> If you update all blue-4 references to blue-5 first, all blue-3 references can be confidently updated to blue-4

      NOTE: These solutions are still error-prone as they require a certain level of attention to detail and care.
  • Does the current system really order the colors within a color group intuitively? Is there a better and more deterministic way to order the colors within a color group (e.g. based on the HEX value)? I believe a UI/color expert would need to look at this system to determine the answer to this question.

  • How does a colorblind developer think about this color system? (one would think they wouldn't be involved with color definition, being colorblind and all but you never know)

---
title: "Fig. 2: Add New Color + Update Order (Illustration)"
---
flowchart TD
	A([AIM: Add a new color between `blue-2` and `blue-3`]);
	B[Rename `blue-3` to `blue-4`];
	C[Rename `blue-4` to `blue-5`];
	D[/Add new value-pair for updated `pink-3`/]
	E[Update all existing references to `blue-3` to `blue-4`]
	F{How do I add update all the references\n that were originally `blue-4` to `blue-5` without\n including those added in the last step?};
	A --> B --> C --> D --> E --> F;
Loading

Focus: Food for thought [Structure]

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"default": {
"red-1": "0xe06e5f",
"red-2": "0xe06d5f",
"red-3": "0xdd2f22",
"red-4": "0x70372f",

"orange-1": "0xd6881a",
"orange-2": "0xf99806",
"orange-3": "0xfc6c14",

"yellow-1": "0xfff9b3",
"yellow-2": "0xffff94",
"yellow-3": "0xffff00",
"yellow-4": "0xf3f312",
"yellow-5": "0xc4be19",

"green-1": "0x99e1aa",
"green-2": "0xb0e298",
"green-3": "0x8cd05f",
"green-4": "0x81d25c",
"green-5": "0xbee83f",

"blue-1": "0x77dddd",
"blue-2": "0x77d4de",
"blue-3": "0x82b5fe",
"blue-4": "0x58a9ed",

"pink-1": "0xe3a4f5",
"pink-2": "0xcf2081",

"brown-1": "0x998888",
"brown-2": "0x776a6a",
"brown-3": "0x746f6f",
"brown-4": "0x4c4444",

"tan-1": "0xf5dcba",
"tan-2": "0xddccaa",
"tan-3": "0xc5b59f",

"white-0": "0xffffff",

"black-0": "0x000000",

"gray-1": "0xeeeeee",
"gray-2": "0xdddddd",
"gray-3": "0xcccccc",
"gray-4": "0xaaaaaa",
"gray-5": "0x8c8c8c",
"gray-6": "0x555555",
"gray-7": "0x444444"
},
"high_contrast": {
"red-1": "0xff0e41",
"green-3": "0x09f04a",
"blue-2": "0x0cbcff",
"yellow-2": "0xffca09",
"yellow-5": "0xff0ebc",
"orange-1": "0xff510b",
"pink-1": "0xf1c0e8",
"green-1": "0x12ffd1",
"green-5": "0x540fff",
"tan-1": "0xaffa1f",
"gray-5": "0x0000fe",
"gray-4": "0xe9af1e"
},
"colorblind_general": {
"red-1": "0x648fff",
"red-3": "0x530000",
"orange-1": "0x179714",
"green-3": "0x09f04a",
"green-4": "0x09e04a"
},
"colorblind_ibm": {
"red-3": "0x648fff",
"red-4": "0x785ef0",
"orange-1": "0xfe6100",
"yellow-2": "0xffb000"
},
"colorblind_paul_tol_vibrant": {
"red-3": "0xcc3311",
"red-4": "0xee3377",
"orange-1": "0xee7733",
"green-3": "0x009988",
"blue-2": "0x33bbee"
}
}
19 changes: 14 additions & 5 deletions data/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -999,19 +999,24 @@ en:
title: Pan the Map
tooltip: Scrolling with the wheel will pan the map. Holding down Shift will zoom and unzoom the map.
color_selection:
title: Map Color Scheme
title: Color Scheme
tooltip: Switch between color schemes
default: Default
example: Example (High Contrast)
high_contrast: High Contrast
colorblind_general: Colorblind Palette - General
colorblind_ibm: Colorblind Palette - IBM
colorblind_paul_tol_vibrant: Colorblind Palette - Paul Tol (Vibrant)
placeholder: Select color scheme
switch_color_scheme:
key: C
colorblind_options:
title: Colorblind Mode
tooltip: Switch between colorblind modes
title: Colorblind Simulator
tooltip: Switch between colorblind simulators
default: Default (None)
protanopia: Protanopia
deuteranopia: Deuteranopia
tritanopia: Tritanopia
placeholder: Select colorblind mode
placeholder: Select colorblind simulator
restore:
heading: You have unsaved changes
description: "Do you wish to restore unsaved changes from a previous editing session?"
Expand Down Expand Up @@ -1164,6 +1169,9 @@ en:
allowLargeEdits:
label: Allow large edits
description: Remove the limitations about editing features that are not currently visible
showColorblindSimulators:
label: Enable colorblind simulators
description: Enable the colorblind simulator combo box on the Preference pane for simulating three color vision deficiencies
version:
whats_new: "What's new in Rapid {version}"
tag_reference:
Expand Down Expand Up @@ -2549,6 +2557,7 @@ en:
map_data: "Toggle map data pane"
issues: "Toggle validation issues pane"
preferences: "Toggle user preferences pane"
switch_color_scheme: "Switch to next color scheme in list"
fullscreen: "Toggle full screen mode"
sidebar: "Toggle sidebar"
wireframe: "Toggle wireframe mode"
Expand Down
5 changes: 5 additions & 0 deletions data/shortcuts.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
"shortcuts": ["preferences.key"],
"text": "shortcuts.browsing.display_options.preferences"
},
{
"modifiers": ["", ""],
"shortcuts": ["preferences.color_selection.switch_color_scheme.key"],
"text": "shortcuts.browsing.display_options.switch_color_scheme"
},
{
"modifiers": ["", ""],
"shortcuts": ["F"],
Expand Down
196 changes: 196 additions & 0 deletions data/styles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
{
"DEFAULTS": {
"fill": { "width": 2, "color": "gray-4", "alpha": 0.3 },
"casing": { "width": 5, "color": "gray-7", "alpha": 1, "cap": "round", "join": "round" },
"stroke": { "width": 3, "color": "gray-3", "alpha": 1, "cap": "round", "join": "round" }
},

"LIFECYCLE": {
"casing": { "alpha": 0 },
"stroke": { "dash": [7, 3], "cap": "butt" }
},

"red-fill": {
"fill": { "color": "red-1", "alpha": 0.3 }
},
"green-fill": {
"fill": { "color": "green-3", "alpha": 0.3 }
},
"blue-fill": {
"fill": { "color": "blue-2", "alpha": 0.3 }
},
"yellow-fill": {
"fill": { "color": "yellow-2", "alpha": 0.25 }
},
"gold-fill": {
"fill": { "color": "yellow-5", "alpha": 0.3 }
},
"orange-fill": {
"fill": { "color": "orange-1", "alpha": 0.3 }
},
"pink-fill": {
"fill": { "color": "pink-1", "alpha": 0.3 }
},
"teal-fill": {
"fill": { "color": "green-1", "alpha": 0.3 }
},
"lightgreen-fill": {
"fill": { "color": "green-5", "alpha": 0.3 }
},
"tan-fill": {
"fill": { "color": "tan-1", "alpha": 0.3 }
},
"darkgray-fill": {
"fill": { "color": "gray-6", "alpha": 0.5 }
},
"lightgray-fill": {
"fill": { "color": "gray-7", "alpha": 0.3 }
},

"motorway": {
"casing": { "width": 10, "color": "red-4" },
"stroke": { "width": 8, "color": "pink-2" }
},
"trunk": {
"casing": { "width": 10, "color": "red-4" },
"stroke": { "width": 8, "color": "red-3" }
},
"primary": {
"casing": { "width": 10, "color": "red-4" },
"stroke": { "width": 8, "color": "orange-2" }
},
"secondary": {
"casing": { "width": 10, "color": "red-4" },
"stroke": { "width": 8, "color": "yellow-4" }
},
"tertiary": {
"casing": { "width": 10, "color": "red-4" },
"stroke": { "width": 8, "color": "yellow-1" }
},
"unclassified": {
"casing": { "width": 10, "color": "gray-7" },
"stroke": { "width": 8, "color": "tan-2" }
},
"residential": {
"casing": { "width": 10, "color": "gray-7" },
"stroke": { "width": 8, "color": "white-0" }
},
"living_street": {
"casing": { "width": 7, "color": "white-0" },
"stroke": { "width": 5, "color": "gray-3" }
},
"service": {
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "white-0" }
},
"special_service": {
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "tan-2" }
},
"track": {
"casing": { "width": 7, "color": "brown-3" },
"stroke": { "width": 5, "color": "tan-3" }
},
"pedestrian": {
"casing": { "width": 7, "color": "white-0" },
"stroke": { "width": 5, "color": "brown-1", "dash": [8, 8], "cap": "butt" }
},
"path": {
"casing": { "width": 5, "color": "tan-2" },
"stroke": { "width": 3, "color": "brown-1", "dash": [6, 6], "cap": "butt" }
},
"footway": {
"casing": { "width": 5, "color": "white-0" },
"stroke": { "width": 3, "color": "brown-1", "dash": [6, 6], "cap": "butt" }
},
"crossing_marked": {
"casing": { "width": 5, "color": "tan-2" },
"stroke": { "width": 3, "color": "brown-4", "dash": [6, 3], "cap": "butt" }
},
"crossing_unmarked": {
"casing": { "width": 5, "color": "tan-2" },
"stroke": { "width": 3, "color": "brown-2", "dash": [6, 4], "cap": "butt" }
},
"cycleway": {
"casing": { "width": 5, "color": "white-0" },
"stroke": { "width": 3, "color": "blue-4", "dash": [6, 6], "cap": "butt" }
},
"bridleway": {
"casing": { "width": 5, "color": "white-0" },
"stroke": { "width": 3, "color": "red-2", "dash": [6, 6], "cap": "butt" }
},
"corridor": {
"casing": { "width": 5, "color": "white-0" },
"stroke": { "width": 3, "color": "green-3", "dash": [2, 8], "cap": "round" }
},
"steps": {
"casing": { "width": 5, "color": "white-0" },
"stroke": { "width": 3, "color": "green-4", "dash": [3, 3], "cap": "butt" }
},
"river": {
"fill": { "color": "blue-2", "alpha": 0.3 },
"casing": { "width": 10, "color": "gray-7" },
"stroke": { "width": 8, "color": "blue-1" }
},
"stream": {
"fill": { "color": "blue-2", "alpha": 0.3 },
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "blue-1" }
},
"ridge": {
"stroke": { "width": 2, "color": "green-3" }
},
"runway": {
"casing": { "width": 10, "color": "black-0", "cap": "butt" },
"stroke": { "width": 8, "color": "white-0", "dash": [24, 48], "cap": "butt" }
},
"taxiway": {
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "yellow-3" }
},
"railway": {
"casing": { "width": 7, "color": "gray-6", "cap": "butt" },
"stroke": { "width": 2, "color": "gray-1", "dash": [12, 12], "cap": "butt" }
},
"ferry": {
"casing": { "alpha": 0 },
"stroke": { "width": 3, "color": "blue-4", "dash": [12, 8], "cap": "butt" }
},
"boundary": {
"casing": { "width": 6, "color": "blue-3", "cap": "butt" },
"stroke": { "width": 2, "color": "white-0", "dash": [20, 5, 5, 5], "cap": "butt" }
},
"boundary_park": {
"casing": { "width": 6, "color": "blue-3", "cap": "butt" },
"stroke": { "width": 2, "color": "green-2", "dash": [20, 5, 5, 5], "cap": "butt" }
},
"barrier": {
"casing": { "alpha": 0 },
"stroke": { "width": 3, "color": "gray-2", "dash": [10, 5, 2, 5], "cap": "round" }
},
"barrier_wall": {
"casing": { "alpha": 0 },
"stroke": { "width": 3, "color": "gray-2", "dash": [10, 5, 2, 5], "cap": "round" }
},
"barrier_hedge": {
"fill": { "color": "green-3", "alpha": 0.3 },
"casing": { "alpha": 0 },
"stroke": { "width": 3, "color": "green-3", "dash": [10, 5, 2, 5], "cap": "round" }
},
"tree_row": {
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "green-3" }
},
"construction": {
"casing": { "width": 10, "color": "white-0" },
"stroke": { "width": 8, "color": "orange-3", "dash": [10, 10], "cap": "butt" }
},
"pipeline": {
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "gray-2", "dash": [80, 2], "cap": "butt" }
},
"roller_coaster": {
"casing": { "width": 7, "color": "gray-7" },
"stroke": { "width": 5, "color": "gray-2", "dash": [10, 1], "cap": "butt" }
}
}
2 changes: 2 additions & 0 deletions modules/core/DataLoaderSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class DataLoaderSystem extends AbstractSystem {

const fileMap = new Map();
fileMap.set('address_formats', 'data/address_formats.min.json');
fileMap.set('color_schemes', 'data/color_schemes.min.json');
fileMap.set('deprecated', 'https://cdn.jsdelivr.net/npm/@openstreetmap/[email protected]/dist/deprecated.min.json');
fileMap.set('discarded', 'https://cdn.jsdelivr.net/npm/@openstreetmap/[email protected]/dist/discarded.min.json');
fileMap.set('imagery', 'data/imagery.min.json');
Expand All @@ -42,6 +43,7 @@ export class DataLoaderSystem extends AbstractSystem {
fileMap.set('preset_overrides', 'data/preset_overrides.min.json');
fileMap.set('qa_data', 'data/qa_data.min.json');
fileMap.set('shortcuts', 'data/shortcuts.min.json');
fileMap.set('styles', 'data/styles.min.json');
fileMap.set('territory_languages', 'data/territory_languages.min.json');
fileMap.set('wmf_sitematrix', 'https://cdn.jsdelivr.net/npm/[email protected]/wikipedia.min.json');

Expand Down
Loading