#<css_text>css_text
Contiene texto con valores { }.
<import package="KScript.Style" />
<css_text>font-size: {@rem(24)};</css_text>import KScript.Style
css_text "font-size: {@rem(24)};"Hojas de estilo escritas en KScript (.ks.css, .ks.scss, .ks.sass), con utilidades de color, tamaño y diseño adaptable.
Impórtalo al principio de un script:
<import package="KScript.Style" />import KScript.Style<css_text>css_textContiene texto con valores { }.
<import package="KScript.Style" />
<css_text>font-size: {@rem(24)};</css_text>import KScript.Style
css_text "font-size: {@rem(24)};"Los comandos se llaman con @, en cualquier expresión: @name(arguments).
@adjust_lightness(color, amount) → stringLos argumentos pueden tener nombre: @adjust_lightness(…, amount: …).
@adjust_lightness('red', '-10%')@alpha(color, opacity) → stringLos argumentos pueden tener nombre: @alpha(…, opacity: …).
.overlay { background: {@alpha('black', 0.5)}; }@between(from, to) → stringLos argumentos pueden tener nombre: @between(…, to: …).
@media {@between('sm', 'lg')} { .grid { grid-template-columns: 1fr 1fr; } }@contrast_color(color, dark?, light?) → stringLos argumentos pueden tener nombre: @contrast_color(…, dark: …, light: …).
.badge { background: #ffcc00; color: {@contrast_color('#ffcc00')}; }@css_var(name, fallback?) → stringLos argumentos pueden tener nombre: @css_var(…, fallback: …).
.card { padding: {@css_var('space-md', '16px')}; }@css_vars(map, prefix?) → stringLos argumentos pueden tener nombre: @css_vars(…, prefix: …).
:root {
{ @css_vars($theme.colors, 'color') }
}@darken(color, amount) → stringLos argumentos pueden tener nombre: @darken(…, amount: …).
.button:active { background: {@darken('#3355ff', 0.1)}; }@down(width) → string@media {@down('md')} { .sidebar { display: none; } }@fluid(min, max, from?, to?) → stringLos argumentos pueden tener nombre: @fluid(…, max: …, from: …).
h1 { font-size: {@fluid(28, 48)}; }@lighten(color, amount) → stringLos argumentos pueden tener nombre: @lighten(…, amount: …).
.button:hover { background: {@lighten('#3355ff', '10%')}; }@mix(color, other, amount?) → stringLos argumentos pueden tener nombre: @mix(…, other: …, amount: …).
.muted { color: {@mix('#3355ff', 'white', 0.3)}; }@rem(px, base?) → stringLos argumentos pueden tener nombre: @rem(…, base: …).
.title { font-size: {@rem(24)}; margin-bottom: {@rem(12)}; }@stylesheet(path, vars?) → stringLos argumentos pueden tener nombre: @stylesheet(…, vars: …).
<do>@write_text('public/theme.css', @stylesheet('theme.ks.css', { brand: '#3355ff' }))</do>@write_text('public/theme.css', @stylesheet('theme.ks.css', { brand: '#3355ff' }))@up(width) → string@media {@up('md')} { .menu { display: flex; } }| Variable | Tipo | Descripción |
|---|---|---|
$vars | map | Valores que se pasan a la hoja de estilos: @stylesheet(path, vars) o kscript css --var name=value. |