# Color — SvelteKit UI

Package: sveltekit-ui 1.1.94

Page: https://www.sveltekit-ui.com/components/color

Category: Data & content

displays a color swatch, optionally with details about its oklch components

Public component import: `Color`

Public manager import: `create_color_manager`

## Usage

```svelte
<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { Color, create_color_manager } from "sveltekit-ui"

  const manager = create_color_manager({
    val: { l: 12, c: 14, h: 16, o: 24, is_dark_theme_invert: true },
    size: 6,
    is_show_details: true,
  })
</script>

<Color {manager} />
```

## Configuration

### `val`

- type: object
- default: null
- description: object with color properties { l, c, h, o, is_dark_theme_invert }

### `is_show_details`

- type: boolean
- default: false
- description: whether the color's numeric details are shown

### `size`

- type: number
- default: 3
- description: the width/height in rem of the color preview

### `border_radius`

- type: number
- default: 0.5
- description: border radius in rem for the color preview box

## Methods

No methods documented.

## Returned state

### `id`

- type: string
- description: unique id for this color swatch instance

### `val`

- type: object
- description: the color object used to generate the final color

### `color`

- type: string
- description: the resulting color as an oklch() or transparent if null

### `is_show_details`

- type: boolean
- description: true if color details (l, c, h, o, is_dark_theme_invert) are shown

### `size`

- type: number
- description: the size in rem of the color preview

### `border_radius`

- type: number
- description: the border radius in rem for the color box
