Skip to the page
Najova

Docs

/

Guides

Styles and themes

A theme sets the colours and fonts of a whole site. A style gives one kind of part its own look, and can change it on hover, on a phone or in the dark.

The theme

Every page starts with webNaja's own look: light and dark colours, a font and rounded corners. $theme changes any of them for the whole site. Each line is a name and a value, and a line that ends in ; dark is for the dark look only.

index.wnaj
$theme
  accent = #0b7a62
  accent = #46e3c2 ; dark
  radius = 14px
$endtheme

$page[Sunrise Bakery]
  $heading[Fresh bread every morning]
  $link[See the menu;/menu;look=primary]
$endpage

› naja serve, then open /

GET /  →  200
:root{color-scheme:light dark;--page:#ffffff;--text:#1d1d26;--muted:#5b5b6b;--surface:#f4f3fa;--border:#e3e1ee;--accent:#0b7a62;--on-accent:#ffffff;--font:system-ui, sans-serif;--mono:ui-monospace, monospace;--radius:14px;--space:16px;--code-bg:#f7f6fc;--code-call:#5b3fd9;--code-text:#0b7a62;--code-num:#b4541a}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--page:#0f1017;--text:#ecebf5;--muted:#a3a2b5;--surface:#181926;--border:#2a2b3d;--accent:#46e3c2;--on-accent:#0f1017;--code-bg:#14151f;--code-call:#a690ff;--code-text:#46e3c2;--code-num:#f0a46b;--radius:14px}}
:root[data-theme="dark"]{color-scheme:dark;--page:#0f1017;--text:#ecebf5;--muted:#a3a2b5;--surface:#181926;--border:#2a2b3d;--accent:#46e3c2;--on-accent:#0f1017;--code-bg:#14151f;--code-call:#a690ff;--code-text:#46e3c2;--code-num:#f0a46b;--radius:14px}
<main class="nj-page" id="page">
<h1 class="nj-heading">Fresh bread every morning</h1>
<a href="/menu" class="nj-button primary">See the menu</a>
</main>

The theme's names become CSS colours the whole page uses. Only accent and radius were changed here: the rest are webNaja's own.

The names webNaja uses are page, text, muted, surface, border, accent, on-accent, font, mono, radius and space, plus the colours of code. Any other name is yours: brand = #ff7a59 can then be used as theme.brand in a style.

Your own styles

$style makes a named look, and a part takes it with style=card. Najova has short names for the settings you use most, and CSS names like margin, display or line-height work too. Numbers without a unit are pixels, and theme.surface is the theme's colour.

index.wnaj
$style[card]
  padding = 20
  corner = 12
  background = theme.surface
  border = theme.border
  shadow = yes
$endstyle

$page[Menu]
  $section[;style=card]
    $heading[Sourdough;3]
    $paragraph[Baked at 6 every morning.]
  $endsection
$endpage

› naja serve, then open /

GET /  →  200
.s-card{padding:20px;border-radius:12px;background:var(--surface);border:1px solid var(--border);box-shadow:0 8px 24px rgb(0 0 0 / .12)}
<main class="nj-page" id="page">
<section class="nj-section s-card">
<h3 class="nj-heading" id="sourdough">Sourdough</h3>
<p class="nj-paragraph">Baked at 6 every morning.</p>
</section>
</main>
Najova's nameWhat it sets
padding, gapSpace inside, and between the parts inside
cornerHow round the corners are
widthThe widest it gets
size, weightText size, and normal, bold or 100 to 900
text, backgroundText colour and background
borderOne colour gives a thin line all round
alignstart, center, end or justify
shadowyes for a soft shadow, or your own

When a line counts

A line can end with when it counts. ; hover is while the pointer is over it, ; phone is on a phone, and ; for link styles the links inside the part. The other lines stay as they are.

index.wnaj
$style[card]
  padding = 24
  border = theme.border
  border-color = theme.accent ; hover
  padding = 14 ; phone
  text = theme.accent ; for link
  weight = bold ; for heading
$endstyle

$page[Menu]
  $section[;style=card]
    $heading[Rye;3]
    $link[Order;/order]
  $endsection
$endpage

› naja serve, then open /

GET /  →  200
.s-card{padding:24px;border:1px solid var(--border)}
.s-card a{color:var(--accent)}
.s-card :is(h1,h2,h3,h4,h5,h6){font-weight:700}
.s-card:hover{border-color:var(--accent)}
@media (max-width:640px){.s-card{padding:14px}}
<main class="nj-page" id="page">
<section class="nj-section s-card">
<h3 class="nj-heading" id="rye">Rye</h3>
<a href="/order" class="nj-link">Order</a>
</section>
</main>
EndingWhen it counts
hover, focus, pressPointer over it, picked with the keyboard, being pressed
open, current, chosenAn open fold, the link to this page, the open tab
first, last, odd, evenIts place in a list
phone, below 960, above 1440Screen widths in pixels (a phone is up to 640)
dark, lightOne look only
stillFor people who've asked for less movement
for linkThe parts inside: link, heading, button, image, item and more, or another style

Endings can be put together, like ; for link hover or ; dark phone. Your styles always win over webNaja's own look, so you never need to fight it.

Movement

$motion makes an animation from its start (; from) to its end (; to), with shares like ; 50% in between. A style plays it with animation. Add a ; still line so it stays still for people who've turned movement off.

index.wnaj
$motion[rise]
  opacity = 0 ; from
  transform = translateY(12px) ; from
  opacity = 1 ; to
  transform = none ; to
$endmotion

$style[hero]
  animation = rise 0.4s ease
  animation = none ; still
$endstyle

$page[Welcome]
  $heading[Hello there;style=hero]
$endpage

› naja serve, then open /

GET /  →  200
@keyframes rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
.s-hero{animation:rise 0.4s ease}
@media (prefers-reduced-motion:reduce){.s-hero{animation:none}}
<main class="nj-page" id="page">
<h1 class="nj-heading s-hero">Hello there</h1>
</main>

Fonts

$font adds a font file from your project, like $font[Onest;fonts/onest.woff2;weight=100 900]. Then font = Onest in the theme uses it everywhere, or font-family = Onest in a style uses it in one place. The file is sent with the page, so it looks the same on every computer.

Light and dark

Pages follow the visitor's computer: light or dark. $themePick adds Light and Dark buttons, and the choice is remembered on that visitor's browser. The ; dark lines in your theme and styles are what change.