skeleton: css background dark fails to load custom setting.
Issue: In Dark Mode App Bar changes to lightest bg-surface-100 when changing dark:bg-surface-800 to dark:bg-surface-900. Secondary: Tailwinds arbitrary value syntax doesn’t work in App Bar dark:bg-#[000000]
Snippet in /src/routes/+layout.svelte:
<AppBar background="bg-surface-100 dark:bg-surface-900">
Steps to reproduce the issue:
- Navigate to https://skeleton.brainandbonesllc.com/ then ensure page is in Dark Mode.
- Ctrl + right click Skeleton header App Bar then inspect in the drop down menu.
- Modify class of data-testid=“app-bar” from dark:bg-surface-800 to dark:bg-surface-900
- App Bar will turn white.
Thanks for making this project; I’ve been enjoying it profusely.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (10 by maintainers)
Well shoot, those are some kind words! I’m thrilled that our humble little project can help you at all. And much respect to the folks in the “back”. I very much appreciate and admire what you do as well.
To be fair I’m still learning Tailwind as well. I really only started using when my partner and I began work on Skeleton ~6 months ago. I’m still learning new tricks and techniques every day. But there’s absolutely some room for improvement in our docs. Every time someone like yourself runs into an issue, that makes us aware of some gaps to fill in. Which then makes the process easier for the next guy, so thanks for your small bit of suffering 😃
With that in mind I’ll spend some time double checking these sections of the docs soon, especially in regards to the light/dark theme settings and Tailwind config. Like I mentioned, I made some updates today that should get us most of the way there. But I’ll use your feedback to refine more.
This is all part of the joy of using a pre-release library on-top of a pre-release framework (SvelteKit). There’s going to be growing pains until we both hit v1.0!
Again, glad to help. If you experience any other issues don’t hesitate to reach out. Likewise I’m on our Discord most of my waking hours, along with a handful of other great contributors. If I can’t answer your question in a timely manner then perhaps one of them can jump in an assist. Thanks again for taking a chance with us though! It’s much appreciated!
Oh and heads up, do be on the lookout for the next update. It includes a lot of polish and new components, but will come with some breaking changes. I hate to do it, but it’s a necessary evil that will make things less painful long term! If you’re curious you can take a peek here:
https://github.com/Brain-Bones/skeleton/issues/194
One final note. It may help to go ahead and use our stylesheet add-ons. These are just a set of canned styles that will take care of the boring stuff like background color, text color, typography, etc for you. You can still override whatever you wish in your own project’s app.postcss (global stylesheet)
https://skeleton.brainandbonesllc.com/guides/styling
Here’s the result with this and a few small tweaks:
Here’s the changes:
layout.svelte
On your logo img tag I added the following:
Finally I dropped everything in your global stylesheet and replace it with:
Likewise I commented out the AppShell slots you weren’t yet using, like sidebars, etc.
Hopefully this helps though 😃
@figuerom16 Sorry for the delay, it’s been a busy day!
I just figured out the issue. It’s really two small things in your Tailwind config. Here’s the full change:
First, you may want to go ahead an follow Tailwind’s recommendation for handling Dark Mode, adding the
darkMode: class. See the instructions here: https://tailwindcss.com/docs/dark-modeWe’ve already got some improvements in place for the documentation in the next release which should make this setting recommendation more obviously. So that’s 100% on us!
Note that if you’re not using the Skeleton Light Switch component you can manually toggle light/dark mode by applying this class to your
app.htmlfile >htmlelement:The second issue is something I’ll try to make more clear in our docs. It looks like you replaced what was present in the
contextsetting, but what you needed to do was extend it with the line we provide. By doing so all color stuff seems to be working as expected.Here’s the result with the changes and manually toggling light/dark mode:
theme.postcss