mirror of
https://github.com/hanzoai/ui.git
synced 2026-11-20 22:36:27 +00:00
The code theme was Dracula on dark and GitHub Light on light, and CodeBlock, Snippet and Terminal drew slate grounds with blue, green and red marks. Every code surface now draws one theme with no hue: a ground, a band and three inks per scheme on design's neutral ladder. A token is told apart by brightness, weight and slant. codeTheme holds two shiki theme objects in place of the names, so the call shapes hosts use keep working. Each colour reads the gui key first and the ladder step second. CodeBlock, Snippet and Terminal follow the page with no theme, and dark or light pins them to that scheme's steps. The editor palettes stay available by name. Code reads left to right under dir=rtl. The inks clear 4.5:1 on every ground in both schemes; the lowest is the dim ink on the band, 6.0:1. scripts/code.mjs checks every computed colour in Chromium and runs in CI as test:code. @hanzo/ui 8.29.11.
104 lines
2.0 KiB
CSS
104 lines
2.0 KiB
CSS
html,
|
|
body {
|
|
margin: 0;
|
|
background: var(--background);
|
|
color: var(--color);
|
|
}
|
|
|
|
a {
|
|
color: inherit;
|
|
}
|
|
|
|
/* The sidebar scrolls on its own, under the header, at the page's height. */
|
|
.rail {
|
|
overflow-y: auto;
|
|
scrollbar-width: thin;
|
|
}
|
|
|
|
.code {
|
|
/* The highlighter (code.ts) paints the ground and every token with
|
|
light-dark(), so the colours here are the theme's and this rule is layout. */
|
|
margin: 0;
|
|
padding: 16px 18px;
|
|
overflow-x: auto;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--borderColor);
|
|
font-family: var(--f-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
font-size: 13px;
|
|
line-height: 1.6;
|
|
white-space: pre;
|
|
tab-size: 2;
|
|
}
|
|
|
|
/* The code theme tells a comment by slant and a keyword by weight. shiki states
|
|
both per theme as custom properties, the same in each, so a token reads them. */
|
|
.code span {
|
|
font-style: var(--shiki-dark-font-style);
|
|
font-weight: var(--shiki-dark-font-weight);
|
|
}
|
|
|
|
/* A docs page's running text: what Markdown emits that no primitive draws. */
|
|
.doc {
|
|
font-size: var(--text-base, 14px);
|
|
line-height: 20px;
|
|
}
|
|
|
|
.doc a {
|
|
color: var(--color12);
|
|
text-decoration: underline;
|
|
text-decoration-color: var(--color8);
|
|
text-underline-offset: 3px;
|
|
}
|
|
|
|
.doc a:hover {
|
|
text-decoration-color: var(--color12);
|
|
}
|
|
|
|
.doc ul,
|
|
.doc ol {
|
|
margin: 0;
|
|
padding-inline-start: 1.5em;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
}
|
|
|
|
.doc li::marker {
|
|
color: var(--color10);
|
|
}
|
|
|
|
.doc :not(pre) > code {
|
|
font-family: var(--f-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
font-size: 0.92em;
|
|
padding: 1px 5px;
|
|
border-radius: 4px;
|
|
background: var(--color3);
|
|
}
|
|
|
|
.doc table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
font-size: 13px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.doc th,
|
|
.doc td {
|
|
text-align: left;
|
|
vertical-align: top;
|
|
padding: 8px 12px;
|
|
border-bottom: 1px solid var(--borderColor);
|
|
}
|
|
|
|
.doc th {
|
|
color: var(--color11);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.doc blockquote {
|
|
margin: 0;
|
|
padding-left: 16px;
|
|
border-left: 2px solid var(--borderColor);
|
|
color: var(--color11);
|
|
}
|