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 theme support to code syntax highlighting #5420

Open
jmuzina opened this issue Dec 2, 2024 · 1 comment
Open

Add theme support to code syntax highlighting #5420

jmuzina opened this issue Dec 2, 2024 · 1 comment
Labels
Maintenance 🔨 P3 Needs decision Needs team agreement in terms of triaging.

Comments

@jmuzina
Copy link
Member

jmuzina commented Dec 2, 2024

Currently our code syntax highlighting is intended only for usage in light theme, and is not legible on dark theme.

Screenshot 2024-12-02 at 11 15 36

We should introduce theme support to the syntax highlighting mixin to use the existing Prism theme on light theme, and the "Tomorrow Night" Prism theme on dark theme.

Context

The code below hard-codes colors from Prism's default theme into Vanilla. It should be updated to vary based in color theme, so that the "Tomorrow Night" theme is applied when an element is a descendant of an is-dark element.

&.property,
&.tag,
&.boolean,
&.number,
&.constant,
&.symbol,
&.deleted {
color: #77216f; // √ brand light aubergine
}
&.selector,
&.attr-name,
&.string,
&.char,
&.builtin,
&.inserted {
color: #0e811f; // positive button bg color nudged to meet AA contrast req on #f7f7f7
}
.operator,
.entity,
.url,
.language-css &.string,
.style &.string {
color: #a86500; // $color-caution darkened to meet AA
}
&.atrule,
&.attr-value,
&.keyword {
color: #06c; // $color-link
}
&.function,
&.class-name {
color: #c7162b; // color-negative
}
&.regex,
&.important,
&.variable {
color: #dc3023; // secondary palette nudged to AA
}

Resources

@jmuzina jmuzina added the P3 Needs decision Needs team agreement in terms of triaging. label Dec 2, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/WD-17470.

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance 🔨 P3 Needs decision Needs team agreement in terms of triaging.
Projects
None yet
Development

No branches or pull requests

1 participant