Skip to content

Exposing theme colors so my own elements can use them in both light & dark mode #661

Answered by metamec
metamec asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out (scss) partly I guess.

Redefine the required colors:

$text-color: #222;
$text-color-dark:  darken(invert(#222), 20);

Use nesting to handle dark mode:

.product-box .item-name {
    color: $text-color;
    transition: all 0.2s ease-in-out;

    .dark-mode & {
        color: $text-color-dark;
    }
}

I figured I'd post in case it helps anyone else. I'm gonna see if I can find the transition effect and replicate it exactly.

Edit: I realised that transition: all 0.2s ease-in-out; is all that's required for transition uniformity. Sorry, I should have really spent longer figuring this out before posting so I'll close this. Hopefully someone else will find the info useful anyway.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by metamec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant