Last year, I had an idea to make theme development easier. I didn’t like the C approach and wanted something a bit less technical. The result is a syntax that is more compact and easier to visually process.
I played with the idea to have a CSS/SCSS-like syntax to generate themes and got reasonably far with it, yet didn’t reach something that was functional. This week I decided to feed the rest of my thoughts into Claude and it went beyond what I expected.
I’ve put it under a permissive MIT license, available on GitHub:
https://github.com/ByteWelder/LSS
The editor/ folder contains syntax plugin support for CLion and VS Code.
In my personal project, I now have a theme that implements Material3 design patterns. Let’s take a look at some of the features.
@theme tag defines the theme name, which is relevant for code generation (files and functions). @config defines the parameters that will go into a custom struct MaterialConfig. These are the parameters that can be used to initialise your theme from code:
@theme material;
@config {
isDark: bool = false;
isCompact: bool = false;
animationsEnabled: bool = true;
colorPrimary: color = #00bbff;
colorSecondary: color = #ee81c3;
colorError: color = #B3261E;
fontSmall: font = raw("LV_FONT_DEFAULT");
fontNormal: font = raw("LV_FONT_DEFAULT");
fontLarge: font = raw("LV_FONT_DEFAULT");
}
You can define additional custom widgets:
@widget toolbar: lvgl_toolbar_class;
@widget icon_button: lvgl_icon_button_class;
And then tokens: a proper design system has layers of tokens, for example:
// Base tokens
// Colors
@neutral-4: #0E0E0E;
@neutral-6: #131313;
// Motion
@duration-short: 100;
@duration-medium: 250;
@duration-long: 500;
// Semantic tokens
@color-primary: if($isDark, mix($colorPrimary, white, 55%), $colorPrimary);
@color-on-primary: if($isDark, mix($colorPrimary, black, 50%), white);
// Widget tokens
// Scrollbar
@scrollbar-color: @color-outline;
@scrollbar-opacity: 40%;
@scrollbar-scrolled-opacity: 70%;
@scrollbar-width: if($isCompact, 2, @space-1);
@scrollbar-pad: if($isCompact, 1, @space-1);
You can define transitions:
@transition state-enter {
props: bgColor, bgOpa, borderColor, textColor, outlineWidth, outlineOpa;
path: ease-out;
duration: @motion-duration-short;
delay: 0;
}
@transition state-exit {
props: bgColor, bgOpa, borderColor, textColor, outlineWidth, outlineOpa;
path: ease-out;
duration: @motion-duration-short;
delay: 70;
}
And then the actual widgets:
button {
bgColor: @button-container-color;
bgOpa: cover;
textColor: @button-label-color;
radius: @button-shape;
padHor: @button-pad-hor;
padVer: @button-pad-ver;
padGap: @button-gap;
}
And rules for the hierarchy:
apply(tabview > obj[1]) {
// Tab content area: no styles
}
And even logic evaluation:
@dialog-gap: if($isCompact, 2, @space-2);
Example theme source (1711 lines):
Example theme generated code (2309 + 60 lines):
The resulting LSS file is about 28% smaller than the combined source files.
Every feature has its own test, which doubles as documentation:

