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 Module - First Draft #147

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cb13637
color: Init first draft
adekunleoduye Jun 21, 2022
e674eeb
fix: clean up format
adekunleoduye Jun 23, 2022
fd0e930
Markdown lobster party!
kaelig Sep 8, 2022
0e2cc98
Updates for future section and tables
ayeshakmaz Sep 26, 2022
055697c
Merge branch 'main' into color-first-draft
ayeshakmaz Sep 26, 2022
bc0f325
More updates
ayeshakmaz Oct 19, 2022
0f02b4c
Merge branch 'color-first-draft' of https://github.com/design-tokens/…
ayeshakmaz Oct 19, 2022
ec0079e
prettier
ayeshakmaz Oct 19, 2022
b688a40
formatting
ayeshakmaz Nov 30, 2022
8ce0869
Update technical-reports/color/index.html
ayeshakmaz May 30, 2023
e4283bc
Update technical-reports/color/index.html
ayeshakmaz May 30, 2023
b938bb9
Update technical-reports/color/color-type.md
ayeshakmaz May 30, 2023
2f4349c
Update technical-reports/color/color-type.md
ayeshakmaz May 30, 2023
f4728eb
Update technical-reports/color/color-type.md
ayeshakmaz May 30, 2023
d25486c
Update technical-reports/color/color-type.md
ayeshakmaz May 30, 2023
f76ef65
Update technical-reports/color/token-naming.md
ayeshakmaz May 30, 2023
a618f5f
Update technical-reports/color/token-naming.md
ayeshakmaz May 30, 2023
3bb8998
Update technical-reports/color/token-naming.md
ayeshakmaz May 30, 2023
70c7212
Update technical-reports/color/color-type.md
ayeshakmaz May 30, 2023
d707312
Merge branch 'main' into color-first-draft
ayeshakmaz May 30, 2023
c5eeb7e
Update to new format with Hex fallback and Colorspace
ayeshakmaz Aug 2, 2023
f34cd40
add: Gradient sections
adekunleoduye Aug 2, 2023
1b18504
format: ran prettier
adekunleoduye Aug 2, 2023
15d896a
format updates
adekunleoduye Aug 2, 2023
5b65608
More format changes
adekunleoduye Aug 3, 2023
e47765b
Merge branch 'main' into color-first-draft
resource11 Aug 20, 2024
e7a9c30
fix format errors
adekunleoduye Aug 20, 2024
62b7771
revert change
adekunleoduye Aug 20, 2024
c61fab2
test verification
adekunleoduye Aug 20, 2024
c58ca34
Sync color-format color type verbiage
resource11 Aug 22, 2024
1226b98
Merge branch 'main' into color-first-draft
resource11 Aug 22, 2024
1195a2f
Merge branch 'main' into color-first-draft
resource11 Oct 31, 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
251 changes: 243 additions & 8 deletions technical-reports/color/color-type.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,257 @@
# The color type
# Color type

Represents a 24bit RGB or 24+8bit RGBA color in the sRGB color space. The `$type` property MUST be set to the string `color`. The value MUST be a string containing a hex triplet/quartet including the preceding `#` character. To support other color spaces, such as HSL, export tools SHOULD convert color tokens to the equivalent value as needed.
Colors can be represented through various formats. For color, the type property must be set to the string color”. For the value, the most common format to represent color through design tokens is a hex triplet. A hex triplet is a 6-digit, 24 bit, hexadecimal number that represents Red, Green, and Blue values as `#RRGGBB`.

For example, initially the color tokens MAY be defined as such:
| Pros | Cons |
| ------------------------------------------ | -------------------------------------- |
| Easily recognized among tools and browsers | Cannot specify alpha value for opacity |

For example, initially color tokens may be defined as such:

<aside class="example">

```json
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Update these examples to match current specification

{
"Majestic magenta": {
"value": "#ff00ff",
"type": "color"
},
"Simple sage": {
"value": "#abcabc",
"type": "color"
}
}
Copy link
Author

Choose a reason for hiding this comment

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

Update examples

```

</aside>

Then, the output from a tool’s conversion to HSL may look something like:

<aside class="example">

```scss
// colors-hex.scss
$majestic-magenta: #ff00ff;
$simple-sage: #abcabc;

// colors-hsl.scss
$majestic-magenta: ​hsl(300, 100%, 50%);
$translucent-shadow: ​hsl(153, 23%, 73%);
```

</aside>

## Other value options

### RGBA

Formatted in R (red), G (green), B (blue) and (A) alpha. Red, green, and blue values can range from 0 to 255 and alpha values can range from 0 and 1 (i.e 0.5) or a percentage (i.e 50%) where 1 or %100 is full opacity.
ayeshakmaz marked this conversation as resolved.
Show resolved Hide resolved

<table>
<tr>
<td><strong>Pros</strong></td>
<td><strong>Cons</strong></td>
</tr>
<tr>
<td>
<ul>
<li>Can define alpha value with color</li>
<li>Alpha value is easy to comprehend at a glance</li>
</ul>
</td>
<td>?</td>
</tr>
</table>

For example, initially color tokens may be defined as such:

<aside class="example">

```json
{
"Majestic magenta": {
"value": {
"red": 255,
"green": 0,
"blue": 255,
"alpha": 1
},
"type": "color"
},
"Simple sage": {
"value": {
"red": 171,
"green": 202,
"blue": 188,
"alpha": "50%"
},
"type": "color"
}
}
```

</aside>

Then, the output from a tool’s conversion to RGBA may look something like:

<aside class="example">

```scss
// colors-rgba.scss
$majestic-magenta: rgba(255, 0, 255, 1);
$translucent-shadow: rgba(171, 202, 188, 50%);
```

</aside>

### HSL

Formatted in H (hue), S (saturation), L (lightness) and an optional (A) alpha. Hue values range from 0 to 360, saturation and lightness are percentage values that go from 0% to 100%, and alpha value can range from 0 and 1 (i.e 0.5) or a percentage (i.e 50%) where 1 or %100 is full opacity (which is the default value if a value isn’t provided).

<table>
<tr>
<td><strong>Pros</strong></td>
<td><strong>Cons</strong></td>
</tr>
<tr>
<td>
<ul>
<li>It is easy to understand compare to other formats</li>
<li>Easy to predict value changes</li>
</ul>
</td>
<td>
<ul>
<li>No supported in older browsers</li>
</ul>
</td>
</tr>
</table>

<aside class="example">

```json
{
"Majestic magenta": {
"h": 300,
"s": "100%",
"l": "50%",
"a": "100%",
"type": "color"
},
"Simple sage": {
"h": 152,
"s": "22%",
"l": "73%",
"a": "100%",
"type": "color"
}
}
```

</aside>

Then, the output variables may look like:

<aside class="example">

```scss
// colors-rgba.scss
$majestic-magenta: hsl(300, 100%, 50%, 1);
$simple-sage: hsl(152, 2
```

</aside>

### Hex8

Hex8 uses two extra digits, known as the alpha value, to change the transparency of the color. The format follows `#RRGGBBAA`. [Learn more about alpha values in hex.](https://www.digitalocean.com/community/tutorials/css-hex-code-colors-alpha-values#adding-an-alpha-value-to-css-hex-codes)
ayeshakmaz marked this conversation as resolved.
Show resolved Hide resolved

<table>
<tr>
<td><strong>Pros</strong></td>
<td><strong>Cons</strong></td>
</tr>
<tr>
<td>
<ul>
<li>Can define alpha value with color</li>
</ul>
</td>
<td>
<ul>
<li>Less commonly used</li>
<li>Alpha value is not immediately obvious (needs calculation)</li>
<li>
Not available in older versions of internet explorer (<a
href="https://caniuse.com/css-rrggbbaa"
>caniuse reference</a
>)
</li>
</ul>
</td>
</tr>
</table>

<aside class="example">

```json
{
"Majestic magenta": {
"$value": "#ff00ff",
"$type": "color"
"value": "#ff00ff80",
"type": "color"
},
"Translucent shadow": {
"$value": "#00000088",
"$type": "color"
"Simple sage": {
"value": "#abcabc80",
"type": "color"
}
}
```

</aside>

Then, the output variables may look like:

<aside class="example">

```scss
// colors-hex.scss
$majestic-magenta: #ff00ff80;
$simple-sage: #abcabc80;

// colors-rgba.scss
$majestic-magenta: rgba(255, 0, 255, 0.5);
$simple-sage: rgba(171, 202, 188, 0.5);
```

</aside>

### LCH (Lightness Chroma Hue)

Formatted in L (lightness), C (chroma), H (hue) and an optional (A) alpha. Hue values range from 0 to 360, saturation and lightness are percentage values that go from 0% to 100%, and alpha value can range from 0 and 1 (i.e 0.5) or a percentage (i.e 50%) where 1 or %100 is full opacity (which is the default value if a value isn’t provided).

<table>
<tr>
<td><strong>Pros</strong></td>
<td><strong>Cons</strong></td>
</tr>
<tr>
<td>
<ul>
<li>Access to 50% more colors (P3 color space)</li>
<li>Colors more perceptually uniform</li>
</ul>
</td>
<td>
<ul>
<li>No fully supported (only safari)</li>
Copy link

Choose a reason for hiding this comment

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

Suggested change
<li>No fully supported (only safari)</li>
<li>Not fully supported (only safari)</li>

Copy link

Choose a reason for hiding this comment

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

Just a nitpick. It would be nice if the Con sections mentioning the lack of browser support were consistent.

Something like

"Limited Browser Support (Safari)"

Consistent verbiage and browsers with support are listed.

</ul>
</td>
</tr>
</table>

---

## Using [Experimental?] color spaces

- Using color spaces like OKLCH, OKLAB, CAM16, Display P-3, etc. may result in lack of support from tools, so plan to have a hex back-up
10 changes: 9 additions & 1 deletion technical-reports/color/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,17 @@ <h1>Introduction</h1>
<em>This section is non normative</em>
ayeshakmaz marked this conversation as resolved.
Show resolved Hide resolved
</p>

<p>Work in progress.</p>
<section
data-include="./overview.md"
Copy link
Member

Choose a reason for hiding this comment

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

The overview.md is missing in this PR. Is this an old link that needs to be removed, or does this file just need to be added to git?

Copy link
Contributor

Choose a reason for hiding this comment

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

  • (This comment is still valid and needs addressing)

data-include-format="markdown"
></section>
</section>

<section
data-include="./token-naming.md"
data-include-format="markdown"
ayeshakmaz marked this conversation as resolved.
Show resolved Hide resolved
></section>

<section
data-include="./color-type.md"
data-include-format="markdown"
Expand Down
7 changes: 7 additions & 0 deletions technical-reports/color/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Color module
Copy link
Member

Choose a reason for hiding this comment

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

I think we may need to move this section directly into the technical-reports/color/index.html file like we do with the format:

<section id="introduction">
<h1>Introduction</h1>
<p>
<em>This section is non normative</em>
</p>
<p>
Design tokens are a methodology for expressing design decisions in a
platform-agnostic way so that they can be shared across different
disciplines, tools, and technologies. They help establish a common
vocabulary across organisations.
</p>

And we can probably remove the Color module title.


Color tokens allow teams to manage color decisions at scale, streamline product consistency, reduce technical debt, and optimize the software development lifecycle.

The goal is to manage color at scale for a product, thereby reducing complexity and communicating the value to stakeholders.

This module describes best practices in regards to naming color tokens, defining color token values, and supporting multiple themes or brands. It also details future plans for the color module and extended value support.
Loading