Nuxt UI sets the foundation of DocLayer’s visual coating. Under the hood, we use predefined library components customizing their appearance to fit DocLayer’s style. The API of Nuxt UI remains consistent, so you can confidently rely on its stability when creating new and custom components. You can read more about building components here.
Now, let’s explore how to control and customize DocLayer’s visual appearance.
To enable visual customization in DocLayer, we use two main bites:
CSS Variables - Created on top of the predefined Nuxt UI and Tailwind CSS variables, our own internal, readable variables that were scoped to specific areas of the application.
Utility Classes - By leveraging Tailwind’s @utilities, we’ve created a set of custom classes that combine and apply these CSS variables. These classes provide a consistent set of styles, mainly used within DocLayer’s internal content components.
Let's dive into each to understand how and where to use them.
We designed CSS Variables to be your primary - and often only - point of contact to visually customize your application. Our goal was to provide a comprehensive set of variables that will let you easily adjust colors, sizes, layouts, and more, giving you the flexibility to tailor the look and feel to your personal or brand preferences.
Use rem unit
Throughout the entire application, we use rem units exclusively for sizing components and layout elements. We recommend maintaining this convention to ensure consistent interpretation of global sizing and metrics.
All of our predefined CSS variables are declared under the Tailwind's @theme rule in the application's style sheets. You can easily override any of these variables in the styles.css file. This is how you can do it:
If you're working with the Boilerplate app the styles.css file also includes important source references for Tailwind. Do not remove them, these are necessary for Tailwind to scan your source files and generate the required classes for your final application build.
styles.css
/* Import DocLayer predefined styles */@import '@vuehouse/dl/styles/main.css';/* Source all of the DocLayer's utility classes */@source '../../node_modules/@vuehouse/dl';@source '../../node_modules/@vuehouse/dl/dist/runtime/components';/* Source all of the utility classes used within the content files */@source '../../content/';/* Source all of the utility classes used within the app files */@source '../../app/';
If you're adding DocLayer separately, please make sure to add the following contents into your assets/styles.css file.
Below, you'll find a list of all default variables, along with clear descriptions of their purpose and instructions on how to use them.
DocLayer's main.css file defines few key CSS variables that are used throughout the entire application. These variables help maintain consistency with Nuxt UI and Tailwind defaults. It's important to not modify these variables directly unless you fully understand the implications. Instead, you should manage them by updating the related --app-* variables. For example, rather than changing --ui-primary directly, update --app-primary, which in turn sets the value of --ui-primary.
Notably, we use the standard Nuxt UI and Tailwind predefined variables. The original setup remains largely unchanged. While you can override any of the original variables if necessary, we recommend doing so only when absolutely required. Before making changes, first check if adjusting one of the internal variables can achieve your desired result.
One of the most impactful ways to change the look and feel of your application is by adjusting the color palette. Since DocLayer supports both dark and light color modes, we’ve provided dedicated variables that will let you control the color scheme of your layout. Below you can find dedicated CSS variables, with their defaults that can be changed as you wish.
To keep color selection simple, we use only four main colors in the scheme. The first two are for the primary color, mainly used in dark mode, while the next two are for light mode being the secondary option.
Let's break these down:
Each palette color is first defined as an RGB code variable (e.g., --app-color-rgb-01). This approach allows us to easily use the modern rgb()CSS function with transparency, which is especially useful for creating color variations with different opacity levels, as seen with the gray-scale colors.
Additionally, there are dedicated gray-scale RGB code variables (e.g., --app-color-gray-rgb), which are then used to define gray colors with specific transparency settings.
Now, let's see how the final color variables are assigned to the primary and secondary app colors:
We've also introduced doomed variants to provide greater flexibility when designing different visual surfaces.
Don't change everything at once
We recommend starting by experimenting with the main palette color codes. Once you're comfortable, you can combine the primary and secondary options to achieve your desired look.
Swapping primaries
It's important to note that the color mode automatically swaps the primary and secondary colors based on the current mode (light or dark). This means you don't need to manually specify different primary or secondary colors for each mode; using --app-primary will handle both cases for you. Remember to keep contrast between both modes, it's important for good readability and accessibility at once.
Below you can find couple of prebuilt themes to choose from. Click a swatch to preview the palette across this site and copy an @theme RGB block for your styles.css.
DocLayer
136 46 69
231 43 96
255 179 193
255 204 213
Amethyst
105 59 152
180 141 205
180 141 205
107 40 134
Ocean
14 116 144
34 211 238
165 243 252
207 250 254
Forest
22 101 52
74 222 128
187 247 208
220 252 231
Ember
153 27 27
248 113 113
254 202 202
254 226 226
Ink
30 41 59
100 116 139
203 213 225
148 163 184
Citrus
180 83 9
251 191 36
254 215 170
255 237 213
Glacier
30 64 175
96 165 250
191 219 254
219 234 254
Moss
63 98 18
132 204 22
217 249 157
236 252 203
Lavender
107 78 152
167 139 250
233 213 255
245 238 255
Blush
157 78 115
244 143 177
252 207 232
253 232 243
Buttercup
146 120 62
253 224 171
254 249 195
255 251 235
Mint
52 120 95
110 231 183
209 250 229
236 253 245
Sky
59 99 147
125 211 252
224 242 254
240 249 255
Sage
87 117 95
163 198 173
220 237 224
236 245 238
Within the next releases we plan to add more structured themes, defining different shapes, colors, fonts, giving more vibrant layout experience.
These variables are responsible for the application typography setup.
styles.css
@theme { /* APP Typography */ --app-font-family: 'Montserrat', sans-serif; /* Be caution while changing the font size as it may affect some layout shifts. */ --app-text-size: 16px; /* 1rem */ --app-code-text-size: var(--text-sm); --app-text-weight-default: 400; --app-text-weight-bold: 700; --app-text-weight-black: 900; --app-text-color-default: light-dark(var(--app-text-color-light), var(--app-text-color-dark)); --app-text-color-light: var(--color-gray-950); --app-text-color-dark: white; --app-text-color-doomed: light-dark(var(--color-gray-500), var(--color-gray-400)); --app-line-height: 1.6; --app-code-text-line-height: 1.5; --app-link-underline-color: var(--ui-secondary); --app-link-visited-color: var(--app-text); --app-link-underline-type: dotted;}
As mentioned before, we rely on the familiar Tailwind predefined variables here, avoiding overwriting the default values, so you mainly have control over the base text colors. As a result, properties like font color, weight, and size remain close to the originals.
To avoid overusing Tailwind classes, we use the modern light-darkCSS function to differentiate color modes. This approach is faster, more efficient, and improves readability. We recommend using this function when defining your own styles as well.
The --app-spacing-factor variable is used in a few places, it's a good idea to experiment with it first to see how it affects the overall spacing of elements.
These variables control the appearance of the layout elements. They help you adjust application's container proportions like width and height, and are also responsible for various navigation styles.
Be mindful when modifying shared variables, as changes can affect the appearance of multiple layout elements. After each update, review the results to ensure there are no unintended style changes.
These variables control the global appearance of the application's components. They help you adjust the appearance of components like: buttons (just for now).
The second layer of theming uses dedicated Tailwind's @utility classes. These are especially helpful when creating new components or customizing the default class sets for DocLayer built-in content components. You can think of them as "boxes" that in most cases group sets of Tailwind classes as well as rules that are using custom variables. This configuration makes it easier to apply dedicated styles to selected areas of the application.
Utility classes are divided into two categories:
global classes, that can be used throughout the entire application, prefixed with u-,
component-specific classes, which are dedicated to the structure and appearance of individual components, all component-specific classes are prefixed with uc-.
Below you'll find all of the global utility classes, component-specific ones are described alongside with certain component pages.
These classes help you maintain consistent spacing throughout the entire app. All of them rely on the --app-spacing variable, so adjusting this variable will update spacing across the whole application.
In some cases, these spacing values were insufficient for proper component styling. In those instances, we used custom spacing values defined directly in rem units.
These classes help you maintain consistent text styles throughout the entire app. They are used to style the application's body text and manage overall typography.
Classes dedicated to maintaining consistent heading sizes. You can spot here the proportions between each type of heading. These classes were used to style the application heading hierarchy. If you want to overwrite them just define your own definitions in the styles.css file
Additionally:
u-heading-overflow can be helpful with handling too long navigation headings,
u-heading-gradient and u-page-heading-gradient were used to set gradients for landing and content page headings.
Finally, it's important to mention the additional, invisible layer of styling: deep styling for Nuxt UI Components. When using these components to build your own, you may occasionally need to apply "deep" styles that target elements within their markup.
Some components include scoped and specific styles to ensure correct presentation and maintain consistency with the app's overall design. To achieve this, we use Vue’s :deep directive to traverse over the markup and to style particular internal elements. However, these styles are often quite sensitive, so we do not make them available for further modification. All other styles remain accessible for you to adjust as needed.
That's it for theming. Additional variables and classes are specific to internal components, and you can find them documented alongside. Reviewing these will help you understand the overall approach and structure of how each component
is built.