Skip to content

Styles & Classes ​

Stylesheet entries ​

FileRequiredContents
@ew-color-picker/style/dist/index.cssYesPicker, box, panel, sliders, buttons, mode switcher, predefine
@ew-color-picker/style/dist/input-number.cssYes for numeric inputsInputNumber component
ts
import '@ew-color-picker/style/dist/index.css'
import '@ew-color-picker/style/dist/input-number.css'

WARNING

Importing only index.css leaves RGB/HSL numeric inputs unstyled.

Class prefix ​

All class names start with ew- by default (e.g. .ew-color-picker-box, .ew-input-number). Change the JS-side prefix with the prefix constructor option and mirror it in the stylesheet through the SCSS $prefix variable:

scss
@use "@ew-color-picker/style/src/index.scss" with ($prefix: "my-");
@use "@ew-color-picker/style/src/input-number.scss" with ($prefix: "my-");

The prebuilt dist/*.css files always use the ew- prefix; keep the default prefix option when using them.

CSS variables ​

VariableSet onDefaultDescription
--panel-width.ew-color-picker-panelcomputed (285/302/320px)Panel width
--panel-height.ew-color-picker-panel180pxPanel height

Override them after importing the styles:

css
.ew-color-picker .ew-color-picker-panel {
  --panel-width: 320px;
  --panel-height: 200px;
}

Class reference ​

Container ​

ClassDescription
.ew-color-pickerRoot container
.ew-color-picker-panel-containerPanel container (absolute)
.ew-color-picker-panel-container-hiddenHidden state
.ew-color-picker-bottom-rowBottom row that hosts inputs and buttons

Box ​

ClassDescription
.ew-color-picker-boxTrigger swatch
.ew-color-picker-box-arrow-iconDefault "has color" icon
.ew-color-picker-box-close-iconDefault "no color" icon
.is-disabled / .is-readonlyStates

Panel ​

ClassDescription
.ew-color-picker-panel2D panel
.ew-color-picker-panel-dynamic-sizeDynamic size marker
.ew-color-picker-white-panel / .ew-color-picker-black-panelGradient layers
.ew-color-picker-panel-cursorDrag cursor

Sliders ​

ClassDescription
.ew-color-picker-sliderHue slider root
.ew-color-picker-is-horizontal / .ew-color-picker-is-verticalOrientation
.ew-color-picker-slider-barHue gradient bar
.ew-color-picker-slider-thumbHue thumb
.ew-color-picker-slider.ew-alphaAlpha slider root
.ew-color-picker-alpha-slider-wrapperCheckerboard + gradient wrapper
.ew-color-picker-alpha-slider-bg / .ew-color-picker-alpha-slider-barLayers
.ew-color-picker-alpha-slider-thumbAlpha thumb

Input & buttons ​

ClassDescription
.ew-color-picker-input-container / -flexText input container
.ew-color-picker-inputText input
.ew-color-picker-input-defaultDefault (hex) input
.ew-input-disabledDisabled text input
.ew-color-picker-drop-btn-group / -multi / -singleButton group
.ew-color-picker-clear-btnClear button
.ew-color-picker-sure-btnSure button
.ew-color-picker-drop-btnShared button style

Color mode ​

ClassDescription
.ew-color-picker-mode-containerMode switcher
.ew-color-picker-mode-up-btn / -down-btnArrows
.ew-color-picker-mode-textCurrent mode label
.ew-color-picker-inputs-groupChannel group
.ew-color-picker-inputs-colOne channel column
.ew-color-picker-input-labelChannel label

Predefine ​

ClassDescription
.ew-color-picker-predefine-containerSwatch container
.ew-color-picker-predefine-colorSwatch wrapper
.ew-color-picker-predefine-color-itemColor fill
.ew-color-picker-predefine-color-disabledDisabled swatch
.ew-color-picker-predefine-color-activeSelected swatch

InputNumber ​

ClassDescription
.ew-input-numberRoot
.ew-input-number--small / --default / --largeSizes
.ew-input-number--focused / --disabledStates
.ew-input-number__inputInput
.ew-input-number__buttonsStepper container
.ew-input-number__button--up / --downSteppers

Theming example ​

css
/* Brand buttons */
.ew-color-picker-sure-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #fff;
}

/* Rounded trigger */
.ew-color-picker-box {
  border-radius: 12px;
}

/* Bigger panel */
.ew-color-picker-panel {
  --panel-width: 340px;
  --panel-height: 200px;
}

Multi-instance isolation ​

Class names are global. If you need per-instance styling, pass a className (Box) or scope styles to a wrapper:

html
<div class="theme-dark">
  <div id="picker"></div>
</div>
css
.theme-dark .ew-color-picker-panel {
  background: #111827;
}

Next steps ​