Skip to content
animagram-jpPublic

About

Universal Design (variants included) system and CSS implementations.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

490 Commits

Folders and files

Repository files navigation

CI OpenSSF Scorecard OpenSSF Best Practices OpenSSF Baseline

Universal Design (variants included) system and CSS implementations.

  • Requires to html only semantic and also structural tags and minimum anonymous elements.
  • Render correctly without JS.

Version

Version Status Date Description
0.1.0 Released 2026-09-28 1st release

This project adheres to Semantic Versioning.

Browser support

Rendering requires Baseline 2024 features: @layer, :has(), light-dark(), color-mix(), relative color syntax, popover and :user-invalid.

Browser Minimum
Chrome, Edge 123
Firefox 128
Safari 18

field-sizing, text-wrap: pretty and :open are progressive enhancements and fall back without layout breakage.

Layer structure

import.css declares the @layer order and imports every file below in that order. Link it alone, or link the files individually and declare the @layer order yourself. Common layer files are following:

  1. reset.css(@layer css.reset): 1st layer to unset all.
  2. base.css(@layer css.base): 2nd layer defining defaults of all custom parameters.
  3. data_style.css(@layer css.data_style): 3rd layer defining data-style attribute.
  4. data_size.css(@layer css.data_size): 4th layer defining data-size attribute.
  5. data_sign.css(@layer css.data_sign): 5th layer defining data-sign and data-facet attributes.
  6. data_union.css(@layer css.data_union): 6th layer defining data-union attribute: removes the gap between adjacent controls and squares their shared corners.

Color

Custom properties are defined in base.css. Override the --color-* properties on any scope to restyle in use.

Category Name Meaning
channel --rgb-accent-red Default channel for --color-error.
--rgb-accent-yellow Default color for --color-highlight-paper.
--rgb-accent-green Default background for --color-success.
--rgb-accent-purple Default channel for --color-emphasis-* and --color-visited.
global parameter --color-ink Default text color in the scheme.
--color-paper Default background color in the scheme.
--color-ink-mix Default mixed to contrast with paper.
--color-paper-mix Default mixed color to contrast with ink.
--color-error Default color for :user-invalid.
--color-highlight-ink Default for ::selection to contrast with paper.
--color-highlight-paper Default for ::selection to contrast with ink.
--color-success Default color for success/true states to contrast with paper.
--color-visited Default a:visited color to contrast with paper.
--color-emphasis-ink Emphasis color to contrast with paper.
--color-emphasis-ink-mix Emphasis mixed to contrast with paper.
scoped parameter color Text color in the scope.
background-color Fill color in the scope.
border-color Border color in the scope.
outline-color Focus color in the scope.

Scoped colors

┌ (backdrop) ────────┐
│  ┏ border ━━━━━━━┓ │
│  ┃  fill         ┃ │
│  ┃ ┌(highlight)┐ ┃ │
│  ┃ │  -text-   │ ┃ │
│  ┃ └───────────┘ ┃ │
│  ┃               ┃ │
│  ┗━━━━━━━━━━━━━━━┛ │
└────────────────────┘
  • :focus outline's requirements is equal to border and it is not nessesary to differ with border.
  • :hover does not have any color difference in basic styles.
  • Empty cells mean as above.
Style Attribute text highlight fill border backdrop
- - color-ink - color-paper(-mix) color-ink color-paper
::selection color-paper color-highlight-ink color-paper(-mix)
data-surround="transparent" color-ink - transparent -
:visited color-visited -
input[type=txt] color-ink - color-paper color-ink-mix
::selection color-paper color-highlight-ink
:disabled color-ink-mix -
:disabled::selection color-paper color-highlight-ink
:user-invalid color-ink - color-error
:user-invalid::selection color-paper color-highlight-ink
data-surround="fill" color-paper - color-emphasis-ink transparent
::selection color-ink color-highlight-paper color-emphasis-ink
:disabled color-paper - color-ink-mix
:disabled::selection color-ink color-highlight-paper color-ink-mix
:active color-paper - color-emphasis-ink-mix
:active::selection color-ink color-highlight-paper color-emphasis-ink-mix
data-surround="outline" color-emphasis-ink - color-paper color-emphasis-ink
::selection color-paper color-highlight-ink
:disabled color-ink-mix - color-ink-mix
:disabled::selection color-paper color-highlight-ink
:active color-emphasis-ink-mix - color-emphasis-ink-mix
:active::selection color-paper color-highlight-ink
:visited color-visited - color-visited
data-style="underline" color-{emphasis}-ink - color-paper -
::selection color-paper color-highlight-ink
:disabled color-ink-mix -
:disabled::selection color-paper color-highlight-ink
:active color-emphasis-ink-mix -
:active::selection color-paper color-highlight-ink
:visited color-visited -
input[type="checkbox"][role="switch"] - - color-ink-mix color-ink-mix color-paper
:user-invalid - - color-error
:disabled - - color-ink-mix
:checked - - color-success color-ink
::after color-ink - color-paper - color-ink-mix
:checked::after color-success
:disabled::after color-ink-mix - color-ink-mix
:checked:disabled::after color-success

Contrast requirements

Requirements come from layer adjacency (text↔highlight↔fill, fill↔border↔backdrop) in the style table above.

The required ratio depends on the scheme.

Scheme text non-text
*-more-contrast 7:1 (AAA 1.4.6) 3:1 (AA 1.4.11)
light, dark 4.5:1 (AA 1.4.3) 3:1 (AA 1.4.11)
*-less-contrast 4.5:1 (AA 1.4.3) 3:1 (AA 1.4.11)
  • Signs (icons, marks, carets) are non-text.
  • A pair of two -mix colors has no requirement.
  • Disabled states (:disabled, [aria-disabled="true"]) have no requirement.
  • The toggle (input[type="checkbox"][role="switch"]) has no error state: its :user-invalid and [aria-invalid="true"] styles have no requirement. Use a checkbox for a value that must be checked.
  • Each row below holds in every scheme at the ratio above.

Emphasis colors are the injection point for a brand or per-scope users' color. The library default is the CUD accent purple. color-success is a non-text fill: it carries no text.

Property text non-text
color-ink color-paper, color-paper-mix color-paper, color-paper-mix
color-ink-mix — color-paper
color-emphasis-ink color-paper color-paper, color-highlight-paper
color-emphasis-ink-mix color-paper color-paper, color-highlight-paper
color-highlight-ink color-paper color-paper, color-paper-mix
color-highlight-paper color-ink —
color-error — color-paper
color-success — color-paper, color-ink
color-visited color-paper color-paper

Size

  • Default width is left unset (auto / content-driven) everywhere.
  • Default margin width is 0.
  • Padding-block is derived from --{size}-box-height and --{size}-line-height and only when border is not none, --{size}-border-width.
Scoped parameter Meaning
--{xs/sm/md/lg/xl/2xl}-border-radius Border radius for the scope.
--{xs/sm/md/lg/xl/2xl}-border-width Border width for the scope.
--{xs/sm/md/lg/xl/2xl}-box-height Block height (border top to bottom) when with 1 line content.
--{xs/sm/md/lg/xl/2xl}-font-size Font size for the scope.
--{xs/sm/md/lg/xl/2xl}-letter-spacing Letter spacing for the scope.
--{xs/sm/md/lg/xl/2xl}-line-height Line height for the scope.
data-size heading box-height font-size letter-spacing line-height
xs - 1.75rem 0.85rem 0.02rem 1.5rem
sm -
md(default) h4~h6 3rem 1rem 0 1.5rem
lg h3 3.5rem 1.15rem 0 1.725rem
xl h2 4rem 1.5rem 0 2.25rem
2xl h1 4.75rem 2rem 0 3rem

Other custom attributes

data-axis

Direction in which a component lays its parts out. Both block and inline are accepted on every component below; omitting the attribute is the same as writing the default.

Selector Default Applied by
hgroup block heading.css
fieldset block radio.css
label inline toggle.css

data-union

  • inline: a horizontal row.
  • block: a vertical stack. Every member is stretched to the same inline size.
Selector Value Applied by
* inline, block data_union.css
* (with label > input[type="radio"] or label > input[type="checkbox"]) inline, block radio.css, checkbox.css, data_style.css, data_size.css

search and form[role="search"] are joined the same way as inline without data-union.

A radio or checkbox member is its label, with the input transparent over it. Checkboxes with role="switch", data-sign or data-facet, and the :indeterminate state, are not supported.

Without data-union, [role="toolbar"], [role="radiogroup"] and [role="tablist"] follow aria-orientation (horizontal by default).

data-step

Layout for the pair of controls a spinbutton or a sortable table header carries. Applied to the span wrapping the pair, not the label/th itself.

Selector Value Applied by
span block step.css

Tag unique attributes

Selector Attribute Description
table data-border sectioned (default) / grid / booktabs; rule style (table.css)
table data-stripe, data-selectable boolean; zebra striping, row selection (table.css)

About

Universal Design (variants included) system and CSS implementations.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages