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

Add a Theme Color select #276

Merged

Conversation

stevejalim
Copy link
Collaborator

@stevejalim stevejalim commented Jan 15, 2024

... instead of picking an arbitrary color and a light or dark theme to go with it

This changeset adds a new ThemeColorBlock option, which is basically a <select> where the value is a CSS class string comprising a theme class (mzp-l-dark|light) and also one of 10 color classes, drawn from the protocol color palette.

This new ThemeColorBlock is used in the HeroBlock and the ColumnBlock, to replace the two places we used a ColorBlock + a ThemeBlock. It's a breaking change, but it's one that we can fixup after deployment with likely no one noticing.

This work is not complete, though. Handing over to @craigcook

Outstanding points to fix

  1. The hero text area used to have a drop shadow on it which was based on the color from the ColorBlock, which is now not at all available to the CSS. This means we can remove the inline CSS (yay) but we'll need a new approach to make the drop-shadow work.

  2. The colors themselves selected for the mozorg and firefox themes are just proofs of concept and could do with some tuning. The only two that MUST remain (or have very similar ones) for consistency on future.m.o are color-purple-10 and color-green-20

Issue

Resolves #212

Testing

@craigcook I have a dump of a local DB here if you want it.

@stevejalim stevejalim requested a review from craigcook January 15, 2024 11:37
stevejalim and others added 5 commits March 28, 2024 22:20
... instead of picking an arbitrary color and a light or dark theme to go with it

This changeset adds a new ThemeColorBlock option, which is basically
a <select> where the value is a CSS class string comprising a theme class
(mzp-l-dark|light) and also one of 10 color classes, drawn from the protocol
color palette.

This new ThemeColorBlock is used in the HeroBlock and the ColumnBlock, to
replace the two places we used a ColorBlock + a ThemeBlock. It's a breaking
change, but it's one that we can fixup after deployment with likely no one
noticing.

This work is not complete, though. Outstanding points to fix:

1) The hero text area used to have a drop shadow on it which was based on
the color from the ColorBlock, which is now not at all available to the CSS.
This means we can remove the inline CSS (yay) but we'll need a new approach
to make the drop-shadow work.

2) The colors themselves selected for the mozorg and firefox themes are just
proofs of concept and could do with some tuning. The only two that MUST
remain (or have very similar ones) for consistency on future.m.o are
color-purple-10 and color-green-20
… we can

dynamically change them, based on the theme in use.

This because light-01 in Mozorg might be Color X, but in Firefox theme it's Y.

This work gives us stable keys to replace with human-readable names instead,
in the next commmit
…ck select...

with approriate human-friendly labels that fit the active theme for the site.
@stevejalim stevejalim force-pushed the 212-refactor-away-colorfield--use-fixed-style-options branch from a12837d to 46f1226 Compare March 28, 2024 18:24
@stevejalim stevejalim marked this pull request as ready for review March 28, 2024 18:24
@stevejalim
Copy link
Collaborator Author

@craigcook I've done some tweaks to this branch to dynamically update the labels for the ColoredThemeBlock options via JS. Can you try them out locally and approve if you're happy with them working? See the commit notes for these two for context:

(You'll need to run migrations/ just preflight after pulling)

@stevejalim stevejalim changed the title Initial pass at adding a Theme Color select Add a Theme Color select Mar 28, 2024
@craigcook
Copy link
Contributor

This seems to work well. Human-readable names for the humans, machine-readable names for the machines.

@stevejalim stevejalim merged commit 07a87ba into main Apr 7, 2024
2 checks passed
@stevejalim stevejalim deleted the 212-refactor-away-colorfield--use-fixed-style-options branch April 7, 2024 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit ColorField to a set of approved, accessible color options
2 participants