-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Use SCSS to derive theme colors from a smaller set of variables #9734
Comments
In my own project I had to mostly rewrite _colors.css myself to because otherwise it was impossible to manage making a dark theme. I took the 67 variables in /* Main theming variables ----------------------------------------------------------------- */
/* This is the base color for all text and icons outside the editor body */
--foreground: var(--vscode-editor-foreground);
/* This is the background color for the editor body */
--background-1: var(--vscode-editor-background);
/* This is the background color for the toolbar */
--background-2: var(--vscode-editorWidget-background);
--background-3: var(--vscode-dropdown-background);
--background-4: var(--vscode-badge-background);
/* From darkest to lightest */
--shadow-1: rgba(0, 0, 0, 20%);
--shadow-2: rgba(2, 1, 1, 0.1);
--shadow-3: rgba(26, 13, 13, 0.05);
/* Other */
--border: var(--background-4);
--focus: var(--vscode-focusBorder);
--focus-dark: var(--vscode-quickInputList-focusBackground);
--semantic-good: hsl(104, 44%, 48%);
--semantic-good-dark: hsl(104, 44%, 30%);
--semantic-warning: orange;
--semantic-bad: hsl(15, 100%, 43%);
--semantic-bad-dark: hsla(9, 100%, 56%, 0.3);
--ck-color-base-action: hsl(104, 44%, 48%); I was planning on potentially submitting a PR with the above CSS changes once my project is more polished. |
cc @oleq |
Thanks for pointing this out. We are aware that theming CKEditor 5 is not an easy feat. Just for clarity, we went with PostCSS mainly because SASS is incapable of handling the complex, modular architecture of the editor and resolve CSS dependencies in such a way no CSS code is duplicated. The way CKEditor 5 is built is uncommon and popular CSS processors such as SASS or Less fail to handle all the corner cases. It took us a lot of time and research to figure it out. Anyway, now that you posted your snippet @adamerose
what prevents you from using SASS in your project and this exact snippet to generate overrides for CKEditor 5 default custom properties? If you wrap these in |
Okay that's understandable.
This is possible but still requires manually adjusting all 67 variables in For example in
Those required me to fiddle around in dev tools to see where those colors show up and how they look and then translate them into 5 new colors for my own theme. I went through this process myself and eventually ended up with CSS like below (that's from my project linked above) where I could play around with those main variables to design my theme.
However, in order to boil all the different colors down to the smaller number of main theming variables in my previous comment's snippet without using SASS I had to get rid of some distinct colors like making It would be possible to use SASS to accurately derive every color in Can the PostCSS implementation used by CKEditor5 do things like |
Disclaimer: If I misunderstood the issue, ignore my comment Correct me if I'm wrong, @oleq, but we used relative colors in the beginning but that wasn't actually helping with recolorization because in a different theme (especially bright vs dark) the dependencies between colors were changing. We dropped that when introducing the dark theme guide, am I right? |
67 variables are simply too much. Makes the use of variables pretty moot IMO. Atleast don't define them on |
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue. |
We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it). |
I am trying to give CKEditor5 a dark theme and am finding the process difficult, the guide links to a list of customizable colors which includes 67 different CSS variables controlling various colors. To give CKEditor5 a custom dark theme I will have to manually adjust a lot of those.
📝 Description of the improvement
Could a possible improvement on CKEditor5 theming be to use SCSS and have more variables derived from base colors? For example given the first snippet below, I would have to manually pick and update all 5 colors to effectively change the color of buttons. But if it was instead SCSS like in the 2nd snippet I would only need to change a single variable.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: