Skip to main content

Color

Bulma provides a comprehensive set of color helpers for text and background colors. These helpers allow you to quickly apply consistent coloring throughout your application without writing custom CSS.

Composable hook

These props are also available standalone via the useColorClasses hook — see Composable Mini-Hooks.

Reference

This page documents the bestax-bulma prop API for Bulma's color helpers. For the underlying CSS utilities, see the official Bulma color helpers.

tip

All components in bestax-bulma have access to these standard color properties through the useBulmaClasses hook. This means you can apply color properties to any component in the library.

Text Color

Use the textColor prop to apply text colors. Most components re-expose Bulma's has-text-* helper under this name, because on components with a filled variant (Button, Notification, Hero, Progress, and others) color renders the is-<color> variant instead of a text color. Some components (Box, Card, Block, and friends) also accept color as a text-color alias, but textColor is the consistent name and takes precedence when both are set. Tag, Input, and table cells have no text-color prop; wrap their content in <Span textColor="..."> instead. The prop accepts Bulma's standard color palette.

Standard Colors

PropertyBulma ClassColor Value
textColor="primary"has-text-primaryPrimary theme color
textColor="link"has-text-linkLink color
textColor="info"has-text-infoInfo blue
textColor="success"has-text-successSuccess green
textColor="warning"has-text-warningWarning yellow
textColor="danger"has-text-dangerDanger red

Monochrome Colors

PropertyBulma ClassColor Value
textColor="black"has-text-blackPure black
textColor="black-bis"has-text-black-bisAlmost black
textColor="black-ter"has-text-black-terDark grey
textColor="grey-darker"has-text-grey-darkerDarker grey
textColor="grey-dark"has-text-grey-darkDark grey
textColor="grey"has-text-greyStandard grey
textColor="grey-light"has-text-grey-lightLight grey
textColor="grey-lighter"has-text-grey-lighterLighter grey
textColor="white"has-text-whitePure white

Theme Colors

PropertyBulma ClassColor Value
textColor="light"has-text-lightLight theme color
textColor="dark"has-text-darkDark theme color

Special Colors

PropertyBulma ClassColor Value
textColor="inherit"has-text-inheritInherit from parent
textColor="current"has-text-currentCurrent color value

Example Usage

import {
  Title,
  SubTitle,
  Button,
  Buttons,
  Box,
  Span,
} from '@allxsmith/bestax-bulma';

function ColorExamples() {
  return (
    <Box p="4">
      <Title textColor="primary">Primary colored title</Title>
      <SubTitle textColor="info">Info colored subtitle</SubTitle>

      <Buttons>
        <Button textColor="success">Success text button</Button>
        <Button textColor="warning">Warning text button</Button>
        <Button textColor="danger">Danger text button</Button>
      </Buttons>

      <p>
        <Span textColor="grey">Grey text </Span>
        <Span textColor="black">Black text </Span>
        <Span textColor="white">White text</Span>
      </p>
    </Box>
  );
}

Background Color

Use the bgColor prop to apply background colors. It accepts the same color values as textColor and renders Bulma's has-background-* helpers — plus, on six surface components, the scheme-* values below, which render as a dark-mode-safe inline style instead of a class. A few components accept the raw backgroundColor helper name instead, and Notification has no background prop at all: its color variant fills the background, so pair it with textColor. Each component's Props table lists the names it takes.

Standard Background Colors

PropertyBulma ClassBackground Value
bgColor="primary"has-background-primaryPrimary theme background
bgColor="link"has-background-linkLink background
bgColor="info"has-background-infoInfo blue background
bgColor="success"has-background-successSuccess green background
bgColor="warning"has-background-warningWarning yellow background
bgColor="danger"has-background-dangerDanger red background

Monochrome Backgrounds

PropertyBulma ClassBackground Value
bgColor="black"has-background-blackBlack background
bgColor="black-bis"has-background-black-bisAlmost black background
bgColor="black-ter"has-background-black-terDark grey background
bgColor="grey-darker"has-background-grey-darkerDarker grey background
bgColor="grey-dark"has-background-grey-darkDark grey background
bgColor="grey"has-background-greyStandard grey background
bgColor="grey-light"has-background-grey-lightLight grey background
bgColor="grey-lighter"has-background-grey-lighterLighter grey background
bgColor="white"has-background-whiteWhite background

Theme Backgrounds

PropertyBulma ClassBackground Value
bgColor="light"has-background-lightLight theme background
bgColor="dark"has-background-darkDark theme background

Special Backgrounds

PropertyBulma ClassBackground Value
bgColor="inherit"has-background-inheritInherit from parent
bgColor="current"has-background-currentCurrent color value

Scheme Backgrounds (adapt to dark mode)

Bulma ships no has-background-scheme-* classes, so these values emit no class at all — the component renders a dark-mode-safe inline style that tracks Bulma's scheme CSS variables. They are supported on six surface components: Section, Hero (and Hero.Head/Hero.Body/Hero.Foot), Container, Footer, Box, and Card (the parent, not its subcomponents). backgroundColorShade is ignored for scheme values — no shaded scheme variables exist.

PropertyEmitted Inline StyleBackground Value
bgColor="scheme-main"background-color: var(--bulma-scheme-main)The page's base surface
bgColor="scheme-main-bis"background-color: var(--bulma-scheme-main-bis)One step off the base surface
bgColor="scheme-main-ter"background-color: var(--bulma-scheme-main-ter)Two steps off the base surface
bgColor="scheme-invert"background-color: var(--bulma-scheme-invert)The inverted (opposite) surface
bgColor="scheme-invert-bis"background-color: var(--bulma-scheme-invert-bis)One step off the inverted surface
bgColor="scheme-invert-ter"background-color: var(--bulma-scheme-invert-ter)Two steps off the inverted surface
Invert backgrounds don't invert your text

The scheme-invert* values set only the background — text keeps the page's default color, which is low-contrast on an inverted surface. Pair them with a matching foreground: a named class with color: var(--bulma-scheme-main) for designs that serve both modes, or an explicit textColor when the design is single-mode — pinned globally with <Theme isRoot colorMode="…">, or per surface with Bulma's data-theme attribute (<Box data-theme="light" bgColor="scheme-invert" textColor="white">). The scheme-main* values need no pairing — they stay close to the page background.

This is the zero-CSS way to build alternating page bands that stay correct in dark mode — tint every other Section with scheme-main-bis, stepping to scheme-main-ter when a later band needs to go one deeper:

import { Section, Title, SubTitle } from '@allxsmith/bestax-bulma';

function AlternatingBands() {
  return (
    <>
      <Section>
        <Title>First Band</Title>
        <SubTitle>Default scheme-main background.</SubTitle>
      </Section>
      <Section bgColor="scheme-main-bis">
        <Title>Second Band</Title>
        <SubTitle>Subtly offset, and it adapts to dark mode.</SubTitle>
      </Section>
      <Section>
        <Title>Third Band</Title>
        <SubTitle>Back on the base surface.</SubTitle>
      </Section>
      <Section bgColor="scheme-main-ter">
        <Title>Fourth Band</Title>
        <SubTitle>One step deeper, still zero custom CSS.</SubTitle>
      </Section>
    </>
  );
}

Example Usage

import { Box, Notification, Card } from '@allxsmith/bestax-bulma';

function BackgroundColorExamples() {
  return (
    <div>
      <Box bgColor="primary" textColor="white" p="4" mb="3">
        Primary background with white text
      </Box>

      <Box bgColor="info" textColor="white" p="4" mb="3">
        Info background with white text
      </Box>

      <Notification color="success" textColor="white">
        Success notification via its color variant
      </Notification>

      <Card bgColor="light" p="4">
        <Card.Content>Light background card</Card.Content>
      </Card>
    </div>
  );
}

Advanced Color Features

For more advanced color features including comprehensive shade variations and semantic color meanings, see the Color Shades documentation.

Learn More

For detailed API information about color properties, see the useBulmaClasses API documentation.

See Also