Introduction
A stylesheet often repeats the same values: a brand colour and its lighter and darker shades, a spacing scale, the widths where a layout changes. KScript stylesheets let you work those out from data instead of copying them by hand.
A file ending in .ks.css, .ks.scss or .ks.sass is a stylesheet written in KScript. It is ordinary CSS or Sass with KScript expressions and control tags in it. theme.ks.css compiles to theme.css:
<let name="brand" value="'#3355ff'" />
.button {
background: {$brand};
color: {@contrast_color($brand)};
padding: {@rem(12)} {@rem(24)};
}
.button:hover { background: {@adjust_lightness($brand, '-10%')}; }Stylesheets import KScript.Style for you, so its helpers, such as @rem and @contrast_color, are always there. Run kscript docs KScript.Style for the package reference.