useBackgroundColor

Commons
stable

Surface-only color helper. Resolves the `bgColor` prop (or a reactive ref) to a utility class (`origam--bg-*`) when the value is a tokenised intent, or to an inline background-color declaration for raw CSS values.

API

Signature

Full TypeScript signature sourced from the composable file.

typescript

Consumed interfaces

IBgColorProps

API

Parameters

Input parameters accepted by this composable.

props
required
T | Ref<TColor>
Either the component props object (paired with `name`) or a plain Ref<TColor>.
name
K
The key to read from the props object. Typically "bgColor". Omit when passing a plain Ref.

API

Return values

Properties and methods exposed by the composable return object.

backgroundColorClasses
Utility class names (e.g. ["origam--bg-primary"]) to bind via :class. Empty when value is gradient or raw hex.
backgroundColorStyles
Inline CSS declarations (e.g. ["background-color: #ff0080"]) to bind via :style. Empty when a utility class applies.

Usage

Examples

Ready-to-paste usage snippets.

Usage with props object

vue

Usage with a plain Ref

vue