codly / docs

Make it yours

Applies to code displayed in the documentation.

GitHub

codly.themes

The built-in theme dictionaries, keyed by preset name; use codly.theme to render one or codly.define-theme to derive a reusable configuration.

Signature

typst code
codly.themes: dictionary

Its six keys are thesis, dark, clean, github-light, solarized-light, and one-light. Each value is a theme dictionary. thesis is Codly’s default appearance.

PresetAppearance
thesisCodly’s ordinary defaults, with language-colored badges and a light header.
darkDark editor palette with light text and syntax colors.
cleanUnboxed code with muted text and unpainted language badges.
github-lightGitHub light editor palette.
solarized-lightSolarized light editor palette.
one-lightOne Light editor palette.

Theme dictionary keys

The theme loader accepts these shared token keys and element-section keys. Unknown top-level keys are rejected.

KindKeysMeaning
Shared tokenforeground, muted, fill, accent, stroke, radius, insetMain text, subdued text, code-line fill, accent color, outline, corner radius, and inner spacing.
Shared tokenheader-fill, footer-fill, bubble-fillFills for headers, footers, and callout bubbles.
Shared tokensyntax, highlight-fill, highlight-colors, language-colorsRaw-code syntax theme, highlight fill, highlight color or palette, and whether language badges use their language colors.
Element sectionblock, line, number, lang, file, header, footer, highlight, callout, bubble, annotationA dictionary of settings for that Codly element. Fields within a section follow that element’s settings; its text field accepts native Typst text settings.

The public theme dictionary can be inspected or selected by key. For the exact merge behavior and validation when creating a custom dictionary, see codly.define-theme.

Behavior

The preset entries are complete theme dictionaries; looking up a preset does not apply it to the document by itself.

Example: Basic Usage

Renders one block per preset for side-by-side comparison:

Typst source
#import "@preview/codly:2.0.0" as codly

#let source = ```py
def double(value):
    return value * 2
```
#grid(
  columns: (1fr, 1fr),
  gutter: 6pt,
  ..codly.themes.keys().map(name => {
    show: codly.theme(name)
    codly.new(source, header: [#name])
  }),
)
Edit & run on your device

The highlighted source and output update after you stop typing. Copy code includes your edits.

OUTPUTPre-rendered default
Rendered output of the Typst example