Skip to main content
Version: 0.1.22

remote-css

Extract colours from CSS variable definitions.

Description

The remote-css plugin parses CSS files to extract colour variables. Use it for:

  • CSS theme files
  • Design system colours
  • Existing CSS-based themes

Usage

tinct generate -i remote-css --remote-css.url "<url>" [flags]

Flags

FlagDefaultDescription
--remote-css.urlCSS file URL (required)
--remote-css.timeout10sRequest timeout

Examples

Basic usage

tinct generate -i remote-css \
--remote-css.url "https://example.com/theme.css" \
-o all

From GitHub

tinct generate -i remote-css \
--remote-css.url "https://raw.githubusercontent.com/user/theme/main/colors.css" \
-o all

CSS format

The plugin parses CSS custom properties (variables):

:root {
--background: #1e1e2e;
--foreground: #cdd6f4;
--accent-primary: #89b4fa;
--accent-secondary: #f5c2e7;
--color-danger: #f38ba8;
--color-warning: #f9e2af;
--color-success: #a6e3a1;
--color-info: #89dceb;
}

Variable name mapping

Variable names are mapped to roles:

CSS variable patternTinct role
--background, --bgbackground
--foreground, --fg, --textforeground
--accent, --primaryaccent1
--secondaryaccent2
--danger, --error, --reddanger
--warning, --yellowwarning
--success, --greensuccess
--info, --blueinfo

Colour formats

Recognised formats in CSS values:

FormatExample
Hex 6#1e1e2e
Hex 3#1e2
Hex 8#1e1e2eff
RGBrgb(30, 30, 46)
RGBArgba(30, 30, 46, 1)
HSLhsl(240, 21%, 15%)

Handling complex CSS

The parser extracts from any valid CSS:

/* Comments are ignored */
:root {
--bg: #1e1e2e;
}

.theme-dark {
--bg: #0a0a0a; /* This is also extracted */
}

@media (prefers-color-scheme: dark) {
:root {
--bg: #1e1e2e; /* And this */
}
}

All colour values found are included in extraction.

Combining with role hints

For precise control:

# Extract CSS then override roles
tinct generate -i remote-css \
--remote-css.url "https://example.com/theme.css" \
-o all

Or use file plugin with extracted values.

Troubleshooting

No colours found

  • Verify URL returns valid CSS
  • Check for CSS variables (--name: value)
  • Ensure colours use recognised format

Wrong role mapping

  • Variable names may not match expected patterns
  • Consider using file plugin for explicit mapping

Timeout

  • Increase timeout: --remote-css.timeout 30s
  • Check URL accessibility

See also