zfb
GitHub repository

Type to search...

to open search from anywhere

Border color

Set physical border colors from configured values or a validated arbitrary color.

Color every border, an axis, or an individual physical edge.

Quick reference

Example classExpected declarations
border-inkborder-top-color: var(--zw-color-ink); border-right-color: var(--zw-color-ink); border-bottom-color: var(--zw-color-ink); border-left-color: var(--zw-color-ink);
border-x-accent/85border-left-color: color-mix(in oklab, var(--zw-color-accent) 85%, transparent); border-right-color: color-mix(in oklab, var(--zw-color-accent) 85%, transparent);
border-y-focusborder-top-color: var(--zw-color-focus); border-bottom-color: var(--zw-color-focus);
border-b-alert/90border-bottom-color: color-mix(in oklab, var(--zw-color-alert) 90%, transparent);
border-l-inkborder-left-color: var(--zw-color-ink);
border-r-accentborder-right-color: var(--zw-color-accent);
border-t-focusborder-top-color: var(--zw-color-focus);
Example setup

The shared preview base explicitly sets spec 1, reset: "none", strict mode, tokens.spacingUnit: "0.25rem", and no breakpoints. Each named value is configured in that example; there is no inherited palette or theme. wind-demo classes are authored context styles; their CSS is shown separately from the utility declarations.

Examples in use

Color a full border or both sides of an axis

border-ink colors all four edges, border-x-accent/85 colors left and right, and border-y-focus colors top and bottom.

Color a full border or both sides of an axis
HTML
<div class="wind-demo-border-colors"><div class="wind-demo-color-box border-4 border-ink p-2">border-ink · all sides</div><div class="wind-demo-color-box border-4 border-x-accent/85 p-2">border-x-accent/85 · left and right</div><div class="wind-demo-color-box border-4 border-y-focus p-2">border-y-focus · top and bottom</div></div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-color-accent: #075985;
    --zw-color-alert: #8b1e3f;
    --zw-color-focus: #0f766e;
    --zw-color-ink: #16324f;
    --zw-color-panel: #edf4f8;
    --zw-color-white: #fff;
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo-border-colors {
  max-width: 34rem;
  color: #16324f;
  font: 14px / 1.5 system-ui, sans-serif;
}

.wind-demo-color-box {
  margin: .7rem 0;
}
.p-2 {
  padding-top: 0.5rem;
  padding-right: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 0.5rem;
}
.border-4 {
  border-top-width: 4px;
  border-top-style: solid;
  border-right-width: 4px;
  border-right-style: solid;
  border-bottom-width: 4px;
  border-bottom-style: solid;
  border-left-width: 4px;
  border-left-style: solid;
}
.border-ink {
  border-top-color: var(--zw-color-ink);
  border-right-color: var(--zw-color-ink);
  border-bottom-color: var(--zw-color-ink);
  border-left-color: var(--zw-color-ink);
}
.border-x-accent\/85 {
  border-left-color: color-mix(in oklab, var(--zw-color-accent) 85%, transparent);
  border-right-color: color-mix(in oklab, var(--zw-color-accent) 85%, transparent);
}
.border-y-focus {
  border-top-color: var(--zw-color-focus);
  border-bottom-color: var(--zw-color-focus);
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem",
      "colors": {
        "ink": "#16324f",
        "accent": "#075985",
        "focus": "#0f766e",
        "alert": "#8b1e3f",
        "panel": "#edf4f8",
        "white": "#ffffff"
      }
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo-border-colors": true,
      "wind-demo-color-box": true
    },
    "safelist": {
      "docs-preview": [
        "border-4",
        "border-ink",
        "border-x-accent/85",
        "border-y-focus",
        "p-2"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo-border-colors { max-width: 34rem; color: #16324f; font: 14px/1.5 system-ui, sans-serif; }
.wind-demo-color-box { margin: 0.7rem 0; }

Give individual edges separate colors

The edge utilities change only the named physical side; border-4 supplies a visible width.

Give individual edges separate colors
HTML
<div class="wind-demo-border-colors"><div class="wind-demo-color-box border-4 border-t-focus p-2">top · focus</div><div class="wind-demo-color-box border-4 border-r-accent p-2">right · accent</div><div class="wind-demo-color-box border-4 border-b-alert/90 p-2">bottom · alert</div><div class="wind-demo-color-box border-4 border-l-ink p-2">left · ink</div></div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-color-accent: #075985;
    --zw-color-alert: #8b1e3f;
    --zw-color-focus: #0f766e;
    --zw-color-ink: #16324f;
    --zw-color-panel: #edf4f8;
    --zw-color-white: #fff;
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo-border-colors {
  max-width: 34rem;
  color: #16324f;
  font: 14px / 1.5 system-ui, sans-serif;
}

.wind-demo-color-box {
  margin: .7rem 0;
}
.p-2 {
  padding-top: 0.5rem;
  padding-right: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 0.5rem;
}
.border-4 {
  border-top-width: 4px;
  border-top-style: solid;
  border-right-width: 4px;
  border-right-style: solid;
  border-bottom-width: 4px;
  border-bottom-style: solid;
  border-left-width: 4px;
  border-left-style: solid;
}
.border-b-alert\/90 {
  border-bottom-color: color-mix(in oklab, var(--zw-color-alert) 90%, transparent);
}
.border-l-ink {
  border-left-color: var(--zw-color-ink);
}
.border-r-accent {
  border-right-color: var(--zw-color-accent);
}
.border-t-focus {
  border-top-color: var(--zw-color-focus);
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem",
      "colors": {
        "ink": "#16324f",
        "accent": "#075985",
        "focus": "#0f766e",
        "alert": "#8b1e3f",
        "panel": "#edf4f8",
        "white": "#ffffff"
      }
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo-border-colors": true,
      "wind-demo-color-box": true
    },
    "safelist": {
      "docs-preview": [
        "border-4",
        "border-b-alert/90",
        "border-l-ink",
        "border-r-accent",
        "border-t-focus",
        "p-2"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo-border-colors { max-width: 34rem; color: #16324f; font: 14px/1.5 system-ui, sans-serif; }
.wind-demo-color-box { margin: 0.7rem 0; }

Custom and named values

Named colors such as border-ink must be configured in tokens.colors; there is no default palette. border-current and border-transparent are supported keywords. A color slash modifier accepts an integer from 0 through 100, such as border-x-accent/85. Bracket values accept validated CSS colors. The border, border-x, border-y, and edge forms select physical sides; combine them with a border-width utility to make the color visible. Width and color share class roots, so numeric suffixes mean width while configured color names mean color.

Related guides: Utility grammar · Variants

Catalog details

border

FieldValue
Catalog identifierv1.border.color
Class patternborder-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-top-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesborder-top-color, border-right-color, border-bottom-color, border-left-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-top-colorresolvednull
border-right-colorresolvednull
border-bottom-colorresolvednull
border-left-colorresolvednull

Catalog examples

Example classExpected declarations
border-[red]/40border-top-color: color-mix(in oklab, red 40%, transparent); border-right-color: color-mix(in oklab, red 40%, transparent); border-bottom-color: color-mix(in oklab, red 40%, transparent); border-left-color: color-mix(in oklab, red 40%, transparent)

border-x

FieldValue
Catalog identifierv1.border.color.x
Class patternborder-x-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-left-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank1
Selector shapeownElement
Spec version1
Emitter propertiesborder-left-color, border-right-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-left-colorresolvednull
border-right-colorresolvednull

Catalog examples

Example classExpected declarations
border-x-[red]/40border-left-color: color-mix(in oklab, red 40%, transparent); border-right-color: color-mix(in oklab, red 40%, transparent)

border-y

FieldValue
Catalog identifierv1.border.color.y
Class patternborder-y-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-top-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank1
Selector shapeownElement
Spec version1
Emitter propertiesborder-top-color, border-bottom-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-top-colorresolvednull
border-bottom-colorresolvednull

Catalog examples

Example classExpected declarations
border-y-[red]/40border-top-color: color-mix(in oklab, red 40%, transparent); border-bottom-color: color-mix(in oklab, red 40%, transparent)

border-b

FieldValue
Catalog identifierv1.border.color.b
Class patternborder-b-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-bottom-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank2
Selector shapeownElement
Spec version1
Emitter propertiesborder-bottom-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-bottom-colorresolvednull

Catalog examples

Example classExpected declarations
border-b-[red]/40border-bottom-color: color-mix(in oklab, red 40%, transparent)

border-l

FieldValue
Catalog identifierv1.border.color.l
Class patternborder-l-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-left-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank2
Selector shapeownElement
Spec version1
Emitter propertiesborder-left-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-left-colorresolvednull

Catalog examples

Example classExpected declarations
border-l-[red]/40border-left-color: color-mix(in oklab, red 40%, transparent)

border-r

FieldValue
Catalog identifierv1.border.color.r
Class patternborder-r-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-right-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank2
Selector shapeownElement
Spec version1
Emitter propertiesborder-right-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-right-colorresolvednull

Catalog examples

Example classExpected declarations
border-r-[red]/40border-right-color: color-mix(in oklab, red 40%, transparent)

border-t

FieldValue
Catalog identifierv1.border.color.t
Class patternborder-t-<suffix>
Grammar{"acceptedKinds":["keyword","token","arbitrary"],"arbitraryProperty":"border-top-color","allowsFractionSlash":false,"allowsColorOpacity":true}
Accepted values2
Token categoriescolors
Negative-value policyforbidden
Conflict group and rankborder-color (25)
Order rank2
Selector shapeownElement
Spec version1
Emitter propertiesborder-top-color

Accepted values

KindSuffixEmitted value
keyword"transparent""transparent"
keyword"current""currentColor"

Declaration templates

PropertyValue kindFixed value
border-top-colorresolvednull

Catalog examples

Example classExpected declarations
border-t-[red]/40border-top-color: color-mix(in oklab, red 40%, transparent)

Revision History

CreatedUpdated