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

How do I change colors for accents ? #12

Closed
pavanpodila opened this issue Oct 11, 2024 · 2 comments
Closed

How do I change colors for accents ? #12

pavanpodila opened this issue Oct 11, 2024 · 2 comments

Comments

@pavanpodila
Copy link

Describe the bug

I love the theme and would like to change the accent color ? Is there an easy way to set the variable or update some config ? I could not find a direct way to do this.

To Reproduce

No easy way to change accent color

Expected behavior

There should be some config to change colors

How often does this bug happen?

Every time

System Info

No response

Additional Context

No response

@HiDeoo
Copy link
Owner

HiDeoo commented Oct 11, 2024

Thanks for the feedback 🙌

At the moment, customization can be done by using Starlight custom CSS and overriding some CSS variables or classes. In the case of the accent colors, the 3 main variables would be --sl-color-accent-low, --sl-color-accent, and --sl-color-accent-high (you can find a complete list here).

Altho, until Cascade Layers are supported by Starlight (currently WIP), you may need to trick the specificity of the CSS selectors to override the default values set by the theme. For example, you can use :root:is(:root) instead of :root to increase the specificity of the selector.

:root:is(:root),
::backdrop:is(::backdrop) {
  --sl-color-accent-low: red;
  --sl-color-accent: red;
  --sl-color-accent-high: red;
}

The above CSS will override the accent colors to red:

image

@HiDeoo HiDeoo closed this as completed Oct 11, 2024
@pavanpodila
Copy link
Author

Awesome ...thanks so much for the direction @HiDeoo ...been following your work and its inspiring! BTW, I am converting some of my websites and apps to adopt Astro as the core framework ... been going great so far.

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

No branches or pull requests

2 participants