Theming
How to customize colors in your documentation
Simple theming, just update globals.css file
We have a globals.css file in the src/styles/globals.css folder. You can update the color of the code block by updating the globals.css file for light and/or dark modes.
In :root section you could update colors for light mode, and in .dark section - for dark mode.
Generate your colors
All colors are presented in HSL format. You can use this tool to generate colors.
Configure codeblock color theme
- Open
contentlayer.config.jsin root folder. 2. FindrehypePrettyCodesettings and update themes for light and dark modes.
{
[
rehypePrettyCode,
{
theme: {
light: "github-light",
dark: "github-dark-dimmed",
},
keepBackground: false,
},
];
}Generate your colors
Full list of available themes you could find here. You should pass value in rehypePrettyCode options from ID column. Press on </> sign in Preview column to see the theme.
- Update
themesection
enum LogLevel {
ERROR,
WARN,
INFO,
DEBUG,
}Modify codeblock colors
Code theme background color
In DoFastDocs we use custom codeblock background color. And we disabled keepBackground: false value in contentlayer.config.js file for rehypePrettyCode.
If you want to use native theme background color, just revert it to true.
Custom code background color
In globals.css file you could update colors for codeblock background for light and dark modes. Update line --codeblock: #fcfcfd; with your custom color.
Custom code line highlight color
To modify code line highlight color, update the next code block with your colors for light and dark modes.
[data-highlighted-line] {
background: rgba(39, 152, 205, 0.06);
}Custom code line number color
Update color in line color: hsl(var(--ring)); for css group code[data-line-numbers] > [data-line]::before.
code[data-line-numbers] > [data-line]::before {
counter-increment: line;
content: counter(line);
/* Other styling */
display: inline-block;
width: 1rem;
margin-right: 2rem;
text-align: right;
color: hsl(var(--ring));
}