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

feat(color): Add new color palette #1415

Merged
merged 76 commits into from
Aug 7, 2023
Merged

Conversation

dancormier
Copy link
Contributor

@dancormier dancormier commented Jul 14, 2023

Note
This PR is targeted to merge into stacks-next, our long-lived branch intended for our v2 release

tl;dr: This PR adds the new color palettes and updates how they're generated.


The new suffix

All added colors include the new suffix. The new color should come immediately before any color stop or h/s/l/

/* Legacy */
--white: …;
--black-200: …;
--theme-base-primary-color-h: …;
.fc-theme-primary-400 { … }

/* New */
--white-new: …;
--black-new-200: …;
--theme-base-primary-color-new-h: …;
.fc-theme-primary-new-400 { … }

New colors

All updated color palettes from the Figma have added. See the new Colors docs page for more details.

Theme generation

Theme colors are now reduced to 6 stops (down from 14), plus a base class/variable that maps to the 400 stop (e.g.: --theme-primary-new: var(--theme-primary-new-400);). All theme colors now fall back to The generation of theme variables/classes now only relies on h/s/l variables, removing any need for r/g/b variables.

See the new Theming docs page for more details.

Base/dark h/s/l/ variables

TODO: Explain how now they're mutually exclusive of one another. Basically, color variables will not fall back to custom light values in dark mode and instead will fall back to default Stacks Classic theme values. This may affect Teams/enterprise, but that needs to be verified.

TODO

  • New color palette with updated stops is created (including new less functions to generate “themed“ palettes) and includes the new suffix
  • Create a colors doc page Colors (new) and to showcase new colors
  • Create a Theming (New) page to showcase the new themed variables (this page will be finalized in a follow up story)

@dancormier dancormier added work-in-progress A work in progress, not meant to merge accessibility breaking changes Pull requests that have breaking changes to the public consumer API stacks-next Changes slated for our Stacks v2 release labels Jul 14, 2023
@netlify
Copy link

netlify bot commented Jul 14, 2023

Deploy Preview for stacks ready!

Name Link
🔨 Latest commit afa19ed
🔍 Latest deploy log https://app.netlify.com/sites/stacks/deploys/64cd34f2af85d60008dd048c
😎 Deploy Preview https://deploy-preview-1415--stacks.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dancormier dancormier requested a review from giamir August 3, 2023 14:37
Comment on lines 159 to 170
--highlight-new-addition: var(--green-700);
--highlight-new-attribute: hsl(206, 98.5%, 29%);
--highlight-new-bg: hsl(0, 0%, 96.5%);
--highlight-new-color: var(--black-750);
--highlight-new-comment: hsl(210, 8%, 43.5%);
--highlight-new-deletion: var(--red-600);
--highlight-new-keyword: hsl(206, 98.5%, 29%);
--highlight-new-literal: hsl(27, 99%, 36%);
--highlight-new-namespace: hsl(27, 99%, 36%);
--highlight-new-punctuation: var(--black-600);
--highlight-new-symbol: hsl(306, 43%, 35%);
--highlight-new-variable: hsl(80, 80.5%, 26.5%);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note
--highlight-* variables referencing legacy colors need to be remapped.
This should be done in a follow-up PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wrote a comment about this in my review. I guess this should be done in a follow up PR because we need design to confirm the mapping old -> new color?

Copy link
Contributor

@giamir giamir left a comment

Choose a reason for hiding this comment

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

Great work @dancormier. 🎉

I left few comments across the PR but overall I think we could merge it.

The most important point I had is if we should create a Borders (new) page before merging, to document how borders are expected to be used with the new color palette. (I also noticed we don't create some bc classes/variables anymore - like bronze-darker, etc... - I suppose that is intentional).

There are also few additional NITs.

docs/product/guidelines/theming-new.html Outdated Show resolved Hide resolved
docs/product/guidelines/theming-new.html Outdated Show resolved Hide resolved
docs/product/guidelines/theming-new.html Outdated Show resolved Hide resolved
docs/product/base/colors-new.html Outdated Show resolved Hide resolved
docs/product/base/colors-new.html Outdated Show resolved Hide resolved
docs/product/base/colors-new.html Outdated Show resolved Hide resolved
lib/exports/colors-new/theme.less Show resolved Hide resolved
muted: hsla(210, 8%, 55%, 0.95);
}

// highlight
Copy link
Contributor

Choose a reason for hiding this comment

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

I could not find any documentation about these highlights variables, is this something we refer only in the code-block and prose styles or also in Core or the editor for example? Try to understand if it makes sense to expose these extra variables or we could encapsulate them directly in those 2 components for the long run.

If the variables are here to be consumed outside stacks I think we should document them somewhere in our docs (maybe a small section in the Colors (new) page)

Any reason why we could not assign the variables to the new color set? Waiting confirmation from design?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could not find any documentation about these highlights variables, is this something we refer only in the code-block and prose styles or also in Core or the editor for example? Try to understand if it makes sense to expose these extra variables or we could encapsulate them directly in those 2 components for the long run.

AFAICT, we only refer to these in the the code-block and prose styles. We technically redefine and reference them in Core but they all have equivalent values and references in Stacks.

I think we could safely consider them private and encapsulate them in those two components. I might want to leave that for a follow up PR though just to minimize moving parts.

Any reason why we could not assign the variables to the new color set? Waiting confirmation from design?

I left these as-is since most of the values referenced are of direct color references (hsl(…) instead of var(…)). I've gone ahead and changed what I could to map to the new color palette, but many colors here are one-offs and don't map to any Stacks colors (new or legacy). I'd like to get design's opinion on this before making too many changes here, though I don't think it needs to hold up this PR.


@PiperLawson considering most colors used for code blocks are custom and not used elsewhere in Stacks, are we planning on updating the colors or do we want to keep those as-is?

Copy link
Contributor

Choose a reason for hiding this comment

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

I also think we should not block this PR because of them. We can revisit those colors later on this month if necessary after we get feedback from design.

Copy link
Contributor

@giamir giamir left a comment

Choose a reason for hiding this comment

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

Thanks @dancormier for taking care of the borders!
We should merge this PR today. Awesome work! 🎉

@dancormier dancormier merged commit 5d38258 into stacks-next Aug 7, 2023
5 checks passed
@dancormier dancormier deleted the dcormier/colors-2023 branch August 7, 2023 15:32
dancormier added a commit that referenced this pull request Oct 6, 2023
* feat(color): Add new color palette (#1415)

* Prepare docs for new colors

* Create color-legacy.less

* Update colors docs page

* Render all new and legacy colors + classes in docs page

* Add tabs to color docs

* Add new color sets

* Maintain new and legacy colors pages separately

* Fix new atomic color class docs

* Add atomic color class generation

* Add new black, white colors

* Add new gold, silver, bronze

* Move new color variable, class generation to new file

* Generate theme color classes

* Add docs to new less color functions

* Fix docs page class rendering

* Move new color files, refactor less functions; add theming

* Remove cruft

* Simplify docs page

* theming…

* Refactor and make some theming progress

* Tweaks!

* Simplify color mixins

* Turn color sets into objects with key/value pairs

* Clean up theme generation

* Simplify color sets

* Add custom theme variables

* Cleanup

* Revert entry.colors.js

* Documentation, cleanup

* add setup to test less mixins

* fix unnecessary extra semicolon in atomic classes rule

* run tests and linters for PRs and pushes into stacks-next

* beautify css snapshots for better readability

* add snapshot of the legacy color/theme generated css

* Get rid of unneeded redirect

* Add page for new theming variables

* Move atomic class generation to atomic/color-new.less

* change .theme-variables to .theme-variables()

* Add utility color variables

* Cleanup!

* Theming!

* font color need to be set per mode

* Update tests

* ⌘ + s

* Update figma link

* Update theming docs slightly

* Update legacy color page to minimize changes to output

* Update new theming docs page

It's not *good*, but it is informative and hopefully useful while we build

* Revert "Update new theming docs page"

This reverts commit a7a19e7.

* Generate custom theme variables for use in light/dark mode by default

* Update theming (new) docs page

* Add child theming docs

* add snapshots for old and new atomic color files

* Implement suggested tweaks

* Show output of theme sliders

* Add new fc variables, update bc variable values

* Cleanup comments

* Tweak theme color stops

* Add status, lightness alias fc/bg classes; tweak theming

* Tweak theming, remove r/g/b from new

* rename theme function

* cleanup

* Add base theme color classes, values

* snapshots, documentation fix

* Move aliased utility class generation

* add snapshot for create-aliased-utility-colors mixin

* Remove new theme rgb references

* Add .fc-new-* alias classes to docs

* Remove border color alias cruft from docs

* Remap new highlight color variables where possible

* Revert "Remove border color alias cruft from docs"

This reverts commit e0aeaca.

* Add new border colors

* Update snapshots

* Add a Borders (new) docs page

* Remove duplicate component-specific theme variables

---------

Co-authored-by: Giamir Buoncristiani <[email protected]>

* chore(deps): fix small conflict resolution mistake

* Implement legacy naming for old color palette (#1440)

* Add legacy suffix to all black colors

* Add legacy suffix to orange, red, blue, green, powder, yellow

* Tons of other misc color changes

* Update css snapshots

* add legacy to theme primary, secondary

* Use legacy colors across docs

* use legacy for single-digit border class stops

* add legacy to utility aliases

* Remove transparent and inherit from legacy color docs

* Label legacy borders as legacy in docs

* Add "(legacy)" to docs page names

* Label remaining legacy colors

* add legacy to fc-light, fc-medium, fc-dark

* add legacy to focus-ring variables

* Add legacy to bc alias vars

* add TODOs for highlight color vars

* Add theme variable todo

* update --focus-ring with legacy suffix

* Update css snapshots

* Update test colors

* Update card visual test colors

* fix typo

* Minor fixes

* Rename docs pages; consolidate border docs

* Tweak theming docs

* move color Less files into versioned directories

* move all legacy files into v1 folders and v2 into root

* Label v1 generated theming variables as legacy

* fix incorrect file paths for less tests

* remove "new" suffix from all v2 colors

* update snapshots

* Update less tests to import from absolute paths

lib/exports/color.less.test.ts was importing "color.less", which would import "lib/atomic.color.less" for some reason. I changed the paths to be explicit and work no matter what directory we chuck this files into.

* Cleanup todos

* Remove dupe variables from legacy (accounted for in new)

* Standardize around v1/v2 for legacy/new colors

* Cleanup stacks-documentation.less a little

* Put those theme colors back!

* Put those focus variables back!

* Refactor utility class generation

* remove new suffix from test setup to avoid confusion

* Fix ADR typo

Resolves #1440 (comment)

* Add more Less tests for create-color-classes

Resolves #1440 (comment)

* Update border color link

Resolves #1440 (comment)

* Add test for create-aliased-utility-classes

Resolves #1440 (comment)

* Ensure high-contrast uses base theme colors

Addresses #1440 (comment)

* theming tweak

---------

Co-authored-by: Giamir Buoncristiani <[email protected]>

* Apply v2 colors to components (#1449)

* Replace component legacy color variables, utility classes

* Replace component monochromatic variables

* Replace gold, sliver, bronze variables

* Replace shade utility variables

* Update a few missed theme variables, --blue

* Missed a couple more theme variables

* Update focus ring variables

* Update generated sidebar widget colors

* Replace less base black/white variables with static CSS vars

* Remove completed todos

* Fix focus ring variable name generation

* Tweak focus-ring default value

* Fix focus ring var generation

* Theming updates

* Update base theme variable color names

* Move legacy border color classes to v1 directory

* Move legacy typography color classes to v1 directory

* Replace misc lingering legacy color references

* Replace legacy Less vars with v2 variables, references

* Replace legacy var references in ADR

* Minor alterations to white values

* Cleanup

* Update Less test snapshot

* Update baseline test images

* Remove errant whitespace

* Remove a11y test skippedTestids

* Replace legacy color reference in docs with new colors (#1450)

* 2.0.0-rc.0

* 2.0.0-rc.1

* Apply v2 colors to components proposed color alterations (#1451)

* Replace component legacy color variables, utility classes

* Replace component monochromatic variables

* Replace gold, sliver, bronze variables

* Replace shade utility variables

* Update a few missed theme variables, --blue

* Missed a couple more theme variables

* Update focus ring variables

* Update generated sidebar widget colors

* Replace less base black/white variables with static CSS vars

* Remove completed todos

* Fix focus ring variable name generation

* Tweak focus-ring default value

* Fix focus ring var generation

* Theming updates

* Update base theme variable color names

* Move legacy border color classes to v1 directory

* Move legacy typography color classes to v1 directory

* Replace misc lingering legacy color references

* Replace legacy Less vars with v2 variables, references

* Replace legacy var references in ADR

* Minor alterations to white values

* Cleanup

* Update Less test snapshot

* Update baseline test images

* Remove errant whitespace

* Improve validation state contrast, differentiation

See all validation states sections in elements under "form" heading in sidebar nav ("Checkbox & Radio", "Inputs", etc)

* Improve label state badge contrast

* activity-indicator: improve warning, dark mode contrast

* badges: improve state badge contrast

* badges: improve user badge contrast, differentiation

I'm not 100% sure about this one. Tough to differentiate them now that the color stops have been reduced

* badges: tweak number count badge bg colors

* badges: remove unneeded hc mode exception

* notice: improve contrast, fix button interaction colors

We can remove sooooo many high-contrast and dark mode overrides 😄 🎉

* post-summary: improve hotness colors

* notice: tweak code background color

* sidebar widgets: tweak background colors

* notice: improve high contrast mode contrast

* activity indicator: improve high contrast

* Darken input success text color

* Remove a11y test skippedTestids

* formatting

* Revert success color change

* update baseline images

* Deprecate primary btn, update filled secondary, other minor btn styling tweaks

* Remove primary variant from btn visual test

* Remove skipped link-preview tests

* Dcormier/components colors v2 proposal vis image revert (#1466)

* Revert "update baseline images"

This reverts commit c2e23a5.

* Kinda revert 19f67c0

* Update activity-indicator.less

* invert activity indicator font color in dark mode

* Update color-sets.less (#1467)

See #1451 (comment)

* Apply v2 color accessibility fixes (round 2) (#1477)

* Add s-block-link__danger to docs, make small tweaks

* activity-indicator: use black text for warning state

Resolves test failure for s-activity-indicator-light-warning-new

* Update activity indicator docs

* link-preview: fix footer/header hc contrast issues

* link-preview: followup contrast fix

* toggle-switch: fix hc contrast on multiple "off"

* Revert 'toggle-switch: fix hc contrast on multiple "off"'

* Update light HC 400 stops

See https://docs.google.com/spreadsheets/d/1ghhgOY3SOpKwGIFFoUrNTM6t3xNp9jOreAb9P_vcuQ0/edit?disco=AAAA32ZEHLA

* Tweak notice btn colors

Resolve failure of s-banner-light-warning-important

* link-preview/code-block: update blue values to pass

resolves s-link-preview-dark-code failure

* toggle-switch: fix dark mode contrast issues

resolves s-toggle-switch-dark-multiple, s-toggle-switch-dark-multiple-off failures

* description: skip accessibility test for disabled variant

side-steps s-description-light-is-disabled, s-description-dark-is-disabled failures

* card: fix accessibility test failures on muted variant

Resolves s-card-dark-muted, s-card-highcontrast-light-muted

* highlight variables: tweak values

* Tweak orange-500, orange-600 light hc values

This resolves all badge-related accessibility test failures

* Remove skipping of various accessibility test ids

* docs: add migration guide (#1481)

* docs: add migration guide

* Remove some extra returns

* Update MIGRATION_GUIDE.md

Co-authored-by: Giamir Buoncristiani <[email protected]>

* Apply suggestions from code review

Co-authored-by: Giamir Buoncristiani <[email protected]>

* Make theming alterations

* Add "Upgrading dependencies" section

* Minor tweaks to migration guide

* The definite article

☝️ good professional wrestler name. When others refer to you as "Definite Article", you could angrily correct them: "It's **The** Definite Article"

* Update MIGRATION_GUIDE.md

---------

Co-authored-by: Giamir Buoncristiani <[email protected]>

* Update light mode orange-400; orange-500 values for APCA (#1485)

* Update MIGRATION_GUIDE.md

* Update MIGRATION_GUIDE.md

* Update MIGRATION_GUIDE.md

* Add missed silver HC color alteration

* Add stacks dep version to MIGRATION_GUIDE

* Remove inline comments from color-sets.less

* Update MIGRATION_GUIDE.md

* 2.0.0-rc.2

* Update MIGRATION_GUIDE.md

* Apply v2 color fixes (round 3) (#1488)

* Set black to #000 in light mode; #fff in dark mode; cleanup

* Darken input, textarea border color

* Lighten s-label, s-description

* Set badge border colors from 400 to 300 stops

* lighten default important notice bg

* Bold page title header

* darken pagination item border color

* Lighten post summary accepted answer color

* Lighten stepped progress bar

* Darken accordion expandable control

* Lighten highlighted user card background color

* Lighten prose kbd border

* Update tag colors

* 2.0.0-rc.3

* Update light mode red-100

* Fix code block bg color in light mode

* 2.0.0-rc.4

* Update less output snapshots

* Fix custom theming; forced dark/light modes

* Update test images

* Formatting

* 2.0.0-rc.5

* Remove component-specific theme variable definitions

Instead, we provide fallback values where they're referenced to prevent cascade collisions/overrulings from consumers

* Update baseline Less test output

* 2.0.0-rc.6

* Tweak color cascade

* 2.0.0-rc.7

* Fix --theme-secondary-400 typo

* 2.0.0-rc.8

* Update MIGRATION_GUIDE.md

* Some unwanted notice docs changes slipped through

* Ensure aliased styles respond to forced color modes

* Update fc-success to use 400 instead of 500

From the sheet:
> The (--fc-success) class looks a bit too dark. It should be set to use green-400 (instead of 500)
> PubPlat - example on Badges list page if you've gotten a badge
> Not sure if this is theme or not actually? Note that accepted answers use green-400 so we should match that.

* Update link font colors per state

* update select border color

* Update color.less.test.ts.snap

* Update baseline test images

* 2.0.0-rc.9

* Update other link interaction state colors

* Update recently merged tests

* Update baseline images

* 2.0.0-rc.10

* Change post summary watched bg to yellow-100

* Update admin badge border color; tweak hc syntax

* Only apply topbar vars to child s-navigation when not within s-popover

* Cleanup

* Update badge baseline visual test images

* Update --theme-topbar-item-color to black-400

Resolves:

> The top nav bar icons are too dark. Change to black-400

* Update a11y tests

* Update baseline images

* 2.0.0-rc.11

* Doc updates to colors and theming (#1500)

* Re-org nav, creating design section

* Add color fundamentals back and half of content

* Add crushed assets

* Move theming items around

* Heading level fix

* Add depecration warnings

* Box in more content, add alt text

* Layer swatches

* Fix dark mode

* Accessibility info

* Theming page updates

* Minor spacing

* Fix heading level

* Update color roles

* Replace most images in color fundamentals docs page

* Replace all color fundamental example images

* Use standard tip

* Swap primary and secondary theme color usages

---------

Co-authored-by: Dan Cormier <[email protected]>

* Match topbar light class to light mode

* Update MIGRATION_GUIDE.md

* Update dark mode toggle switch, radio, checkmark

* Update dark mode saturated colors

* Update color.less.test.ts.snap

* tweak theme generation; rm lightness clamping

* 2.0.0-rc.12

* Change bold text weight from 600 to 700

* Update theming algo

* 2.0.0-rc.13

* Simplify custom theme variable generation

* 2.0.0-rc.14

* Fix tag high contrast theme colors

* 2.0.0-rc.15

* Update purple 100, 200 values

* update less snapshots

* Documentation and migration guide updates

---------

Co-authored-by: Giamir Buoncristiani <[email protected]>
Co-authored-by: Giamir Buoncristiani <[email protected]>
Co-authored-by: paintedbicycle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility breaking changes Pull requests that have breaking changes to the public consumer API stacks-next Changes slated for our Stacks v2 release work-in-progress A work in progress, not meant to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants