Skip to content
Back to skills

Theme

ASecurity

Use when building or fixing a custom Gramax theme — brand colors, CSS-variable overrides, the file loaded in Appearance → CSS-style. Triggers on "кастомная тема", "тема под брендбук", "перекрасить Gramax", "фирменные цвета", "custom theme", "brand theme", "CSS-style".

  • 628 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 26, 2026
documentationgoawsgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add Gram-ax/gramax --skill theme --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Theme?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Theme
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gram-ax-theme/badge)](https://www.skillsdirectory.com/skills/gram-ax-theme)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: theme
description: Use when building or fixing a custom Gramax theme — brand colors, CSS-variable overrides, the file loaded in Appearance → CSS-style. Triggers on "кастомная тема", "тема под брендбук", "перекрасить Gramax", "фирменные цвета", "custom theme", "brand theme", "CSS-style".
---

# Custom Gramax theme

A theme is a single CSS file an admin uploads in **Settings → Appearance → CSS-style**. It overrides variables and loads last.

Every rule below was paid for with a round-trip against the running app.

## 1. Brand sources

A brandbook gives the palette but not how it lives on screen. Before writing anything, **pull the CSS of the brand's live site**: `curl` the homepage → find `<link rel=stylesheet>` → extract `--color-*` and `font-family`.

The live site answers what the brandbook does not: link color inside body text, page background, hover shades, shadows.

But site tokens lie about character too: RSHB's `.md-container p.h1` sets `font-weight: 400`, while the promo headings on the same pages are bold. **Look at page screenshots, not only at CSS.**

If a Russian-domain site refuses to load, the cert is signed by the Ministry of Digital Development CA, absent from the macOS store. Verify the issuer with `openssl s_client`, then fetch with chain verification off.

## 2. Cascade

```css
:root:root:root,
#custom-style { /* light */ }

@media not print {
	:root:root:root.theme-dark,
	:root:root:root[data-theme="dark"],
	:root:root:root.dark,
	#custom-style.theme-dark,
	#custom-style[data-theme="dark"],
	#custom-style.dark,
	.theme-dark #custom-style,
	[data-theme="dark"] #custom-style,
	.dark #custom-style { /* dark */ }
}
```

`:root:root:root` (0,3,0) beats the shipped theme declarations; `#custom-style` (1,0,0) is required for portals — tippy and modals mount into `body`, bypassing the wrapper. `@media not print` keeps a dark-theme page from printing black.

The app applies the theme in `core/extensions/Theme/utils.ts`: `body.dataset.theme = theme` and `documentElement.className = theme`. So the dark block must outrank the light one on both elements.

## 3. Value formats

| What | Format | Example |
|------|--------|---------|
| UI Kit tokens (`--primary-*`, `--secondary-*`, `--status-*`, `--alpha-*`, `--chart-*`, palette `--mint`…) | bare HSL triplet | `--primary-bg: 0 0% 97%;` |
| `--color-*` from `vars.css` / `article.css` | ready color | `--color-link: #42ab44;` |
| Exception | `--color-skeleton-bg` — triplet | |

## 4. What paints what

Verified in code, not guessed:

| Surface | Token |
|---------|-------|
| App background (`body`) | `--color-article-bg` (`global.css`) |
| Cards, dropdowns, popovers, modals | `--secondary-bg` |
| Panels, menu buttons, catalog left nav, home page wrapper | `--primary-bg` |
| Sidebar panel | `--sidebar-bg` |
| Home page header, glass panels | `--alpha-40` (+ `backdrop-filter`) |
| Active article in the tree | `--primary-accent` (class `data-[active=true]:text-primary-accent`) |
| Top-level tabs | `--color-nav-item-selected` |
| Nav items / their hover | `--color-nav-item` / `--color-lev-sidebar-hover` |
| Info admonition | `--status-info-*` |
| Property tags | `--color-property-{bg,border,text}-<style>` (20 styles) |
| Catalog cards | `--color-card-bg-<style>` (20 gradients) |

`--color-home-bg` is declared in `vars.css` but never used — don't spend time on it.

## 5. Pairs that must not drift

- **`--primary-bg` = `--sidebar-bg`.** The panel paints with `bg-sidebar-bg`, menu buttons inside it with `bg-primary-bg`. Let them differ and every item grows its own plate.
- **`--alpha-*` is one scale** covering the home header, glass surfaces and popovers. Base it on the theme's own surface color. If you set `--alpha-10/20/30`, set **every** step — the header reads `40`, and half a scale in another tone shows as mismatched surfaces.
- **Tint the background via `--color-article-bg`**, never `--secondary-bg` — the latter also paints dropdowns and cards.

## 6. Color

- **Green (any warm chromatic) over large dark areas reads as dirt.** Keep background saturation ≤6%; if an explicit tint is wanted, move the hue away from grass `130–140` (turns khaki) toward emerald `155`.
- **A dark theme without steps is a black sheet.** Spread them: canvas `11%`, panels `15%`, hover `25%`, borders `24–28%`.
- **Measure hover against its actual backdrop, not against white.** Floating panels and menus are tinted themselves: a `92%` hover on a `95%` panel is invisible. Keep ≥5 points of lightness from *the surface it sits on*.
- **A vivid brand accent is not readable text.** `#42AB44` on light is 2.9:1. Give the vivid tone to fills, and a darker tone of the same family to text roles (links, active item).
- **A brandbook's secondary palette** (ochre, olive, gold) is meant for diagrams and print. In UI it turns muddy yellow-green — leave tags and cards on stock colors.
- A brand yellow almost always fails contrast as text on light — fills and highlights only.

## 7. Rules targeting markup

Tokens don't always reach: the home background and the left nav share `--primary-bg`; floating and docked panels differ only by shadow; the active article takes the shared accent. Then write a rule, under two laws:

1. **Scope it to the theme:** `body#custom-style:not([data-theme="dark"]) …`. Unlike tokens, such rules don't switch themselves and will leak into the other theme.
2. **Tailwind bang utilities (`!bg-primary-bg`) carry `!important`** — without a matching `!important` the rule loses regardless of specificity.

Target a class substring: `[class*="shadow-glass-lg"] > [data-sidebar="sidebar"]`, `[data-active="true"][class*="text-primary-accent"]`. Keep such rules to a minimum and list them when handing the theme over — they break when markup is refactored.

## 8. Fonts

- Stack: brand faces first, an available substitute next, system fonts last.
- **Pick a variable family.** Static Ubuntu ships `300/400/500/700`; the `font-semibold` (600) class rounds **up** to Bold and the UI looks overweight. The fix is not tuning weights but switching to `Ubuntu Sans` / `Mulish` (range `300..700`).
- Check Cyrillic coverage and range before wiring a font in:
  ```sh
  curl -s "https://fonts.googleapis.com/css2?family=Mulish:wght@300..700&display=swap" | grep -E "U\+0400|font-weight"
  ```
- Commercial faces (Proxima Nova, KievitPro) cannot be linked — ship an `@font-face` stub plus a working free substitute as the default.

## 9. Not reachable by variables

- `h1` weight is hardcoded; `--font-weight-article-heading` only covers `h2`–`h6`.
- `shadow-soft-*` are static values in the `ics-ui-kit` preset.
- `blockquote` — `border-left: 5px solid #eee` in `article.css`.
- Syntax highlighting — a separate set of Prism tokens in `code-block.css`.

Name these out loud instead of quietly routing around them.

## 10. Checklist

- [ ] Variable names untouched; value formats per section 3.
- [ ] Every token set in the light block has a dark counterpart. Missing `--color-article-bg` leaves `body` light in dark mode, and panels glow through it.
- [ ] `--primary-bg` = `--sidebar-bg`; the `--alpha-*` scale is complete.
- [ ] Hovers checked on their own backdrops, floating panels included.
- [ ] Markup-targeting rules scoped to a theme, and counted.
- [ ] Code blocks, tables and admonitions separate from the article background.
- [ ] `bunx biome check --write <file>`.
- [ ] Report: which hex values the brand contributed, what changed in meaning, what stayed hardcoded.

## 11. Working style

- **Check the hypothesis in code before touching a color.** "It didn't apply" is first a selector and `!important` question, then specificity, and only then the value.
- Changing a color is one line; finding the right token is a grep over `core/`. The grep is cheaper than three rounds of guessing shades.
- Change only what was asked. Name an adjacent problem in words and offer it.
- Comments inside the theme file are the client's call — ask before sprinkling them.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.