How Do i Wind whether the website is using the light theme or the dark theme. #6814
-
How do I Find whether the Hosted website is using the light theme or the dark theme. for the code highlighting. the below code looks good on the dark theme but not on the light theme. :root > * {
--md-code-hl-number-color: #B5CEA8;
--md-code-hl-special-color: #DCDCAA;
--md-code-hl-function-color: #DCDCAA;
--md-code-hl-constant-color: #569CD6;
--md-code-hl-keyword-color: #C586C0;
--md-code-hl-string-color: #CE9178;
--md-code-hl-name-color: #9CDCFE;
--md-code-hl-operator-color: #D4D4D4;
--md-code-hl-punctuation-color: #D4D4D4;
--md-code-hl-comment-color: #6A9955;
--md-code-hl-generic-color: #9CDCFE;
--md-code-hl-variable-color: #9CDCFE;
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The documentation about custom color schemes contains the information about switching CSS depending on which theme is used. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
You can use the CSS selectors described here to switch the color variables for the code. Note that the default color schemes are called [data-md-color-scheme="default"] {
--md-code-hl-number-color: #B5CEA8;
--md-code-hl-special-color: #DCDCAA;
--md-code-hl-function-color: #DCDCAA;
--md-code-hl-constant-color: #569CD6;
--md-code-hl-keyword-color: #C586C0;
--md-code-hl-string-color: #CE9178;
--md-code-hl-name-color: #9CDCFE;
--md-code-hl-operator-color: #D4D4D4;
--md-code-hl-punctuation-color: #D4D4D4;
--md-code-hl-comment-color: #6A9955;
--md-code-hl-generic-color: #9CDCFE;
--md-code-hl-variable-color: #9CDCFE;
}
[data-md-color-scheme="slate"] {
--md-code-hl-function-color: #FFFFFF;
} |
Beta Was this translation helpful? Give feedback.
You can use the CSS selectors described here to switch the color variables for the code. Note that the default color schemes are called
default
andslate
. The following switches just one color but you can modify this to your heart's content: