timepicker-ui
4.7.0GitHub
timepicker-ui
Features / Themes

Themes

12 built-in themes, or your own through CSS variables

Available Themes

#
basic
Default Material Design theme with clean aesthetics
crane
Google Crane theme with rounded corners
crane-straight
Google Crane theme with straight edges and sharp corners
m3-green
Material Design 3 with green color scheme
m2
Material Design 2 classic theme
dark
Dark mode theme with high contrast
glassmorphic
Modern glass effect with blur and transparency
pastel
Soft pastel colors for gentle aesthetics
ai
AI-inspired theme with light gray surfaces and a solid blue accent
cyberpunk
Neon cyan accents and a cyan glow on dark indigo surfaces
blueprint New in v4.4.0
Light precision-instrument look - vivid cobalt accent, pale blue surfaces and hairline borders
blueprint-dark New in v4.4.0
Dark sibling of Blueprint - brighter cobalt on navy surfaces with hairline borders

Crane and contrast

In crane and crane-straight the keyboard focus ring uses the theme's coral --tp-outline.

Known exception: the Crane red on plum is below the 3:1 non-text contrast of WCAG 1.4.11 for the selected clock tip circle and the selected AM/PM fill. The white text on them meets AA.

The dark theme in 4.7.0

#

The dark theme now uses the Material 3 baseline dark palette, so it matches the basic theme and the other M3 themes. Before, it was toned like Material 2. The card is lighter (surface #2b2930), the accent is #d0bcff, and the selected hour and the AM / PM button use tonal containers instead of a solid purple fill. No option, class or file name changed. The tokens that were unset now have dark values, where they used to fall back to the light ones.

TokenBefore 4.7.04.7.0
--tp-bg#1c1b1f#2b2930
--tp-surface, --tp-input-bg#2c2b30#36343b
--tp-surface-hover, --tp-hover-bg#3b3940#444249
--tp-surface-containerunset (light #f3edf7)#211f26
--tp-text, --tp-on-surface#e5e5e5#e6e0e9
--tp-on-surface-rgb229, 229, 229230, 224, 233
--tp-text-secondary, --tp-text-type-time, --tp-text-icon, --tp-am-pm-text-unselected#a1a1a1#cac4d0
--tp-on-surface-variantunset (light #49454f)#cac4d0
--tp-text-disabledrgba(161, 161, 161, 0.6)rgba(230, 224, 233, 0.38)
--tp-primary, --tp-outline#bb86fc, #d8b4fe#d0bcff
--tp-primary-rgbunset (light 103, 80, 164)208, 188, 255
--tp-on-primary#000000#381e72
--tp-primary-containervar(--tp-primary)#4f378b
--tp-on-primary-container#000000#eaddff
--tp-tertiary-container, --tp-am-pm-activevar(--tp-primary)#633b48
--tp-on-tertiary-container, --tp-am-pm-text-selected#000000#ffd8e4
--tp-outline-variantunset (light #cac4d0)#49454f
--tp-borderrgba(255, 255, 255, 0.12)#49454f
--tp-dropdown-option-bg#2c2b30#2b2930
--tp-dropdown-option-text#e5e5e5#e6e0e9
--tp-error#ff6b6b#f2b8b5
--tp-wheel-highlight-bgrgba(187, 134, 252, 0.12)#4f378b
--tp-wheel-highlight-borderrgba(255, 255, 255, 0.12)#49454f
--tp-wheel-text-color#e5e5e5#e6e0e9
--tp-wheel-selected-color#bb86fc#eaddff

Keep the old look

Set the old values on [data-theme='dark'] after the theme stylesheet. The four tokens that were unset in the old theme took these values from the light defaults.

index.css
[data-theme='dark'] {
--tp-bg: #1c1b1f;
--tp-surface: #2c2b30;
--tp-input-bg: #2c2b30;
--tp-surface-hover: #3b3940;
--tp-hover-bg: #3b3940;
--tp-surface-container: #f3edf7;
--tp-text: #e5e5e5;
--tp-on-surface: #e5e5e5;
--tp-on-surface-rgb: 229, 229, 229;
--tp-text-secondary: #a1a1a1;
--tp-text-type-time: #a1a1a1;
--tp-text-icon: #a1a1a1;
--tp-am-pm-text-unselected: #a1a1a1;
--tp-on-surface-variant: #49454f;
--tp-text-disabled: rgba(161, 161, 161, 0.6);
--tp-primary: #bb86fc;
--tp-outline: #d8b4fe;
--tp-primary-rgb: 103, 80, 164;
--tp-on-primary: #000000;
--tp-primary-container: var(--tp-primary);
--tp-on-primary-container: #000000;
--tp-tertiary-container: var(--tp-primary);
--tp-am-pm-active: var(--tp-primary);
--tp-on-tertiary-container: #000000;
--tp-am-pm-text-selected: #000000;
--tp-outline-variant: #cac4d0;
--tp-border: rgba(255, 255, 255, 0.12);
--tp-dropdown-option-bg: #2c2b30;
--tp-dropdown-option-text: #e5e5e5;
--tp-error: #ff6b6b;
--tp-wheel-highlight-bg: rgba(187, 134, 252, 0.12);
--tp-wheel-highlight-border: rgba(255, 255, 255, 0.12);
--tp-wheel-text-color: #e5e5e5;
--tp-wheel-selected-color: #bb86fc;
}

Using Themes

#

Apply a theme by setting the theme option:

index.ts
const picker = new TimepickerUI(input, {
ui: {
theme: 'cyberpunk'
}
});
picker.create();

Import Theme Styles

#

Import only the theme you need to reduce bundle size:

Option 1: All themes (largest)

index.ts
import 'timepicker-ui/index.css';

Option 2: Base + specific theme (recommended)

index.ts
import 'timepicker-ui/main.css';
import 'timepicker-ui/theme-cyberpunk.css';

Option 3: Only base (basic theme only)

index.ts
import 'timepicker-ui/main.css';

Dynamic Theme Switching

#

Change themes at runtime with setOptions():

index.ts
// Initialize with basic theme
const picker = new TimepickerUI(input, {
ui: {
theme: 'basic'
}
});
picker.create();
// Switch to dark theme
picker.setOptions({ ui: { theme: 'dark' } });
// Switch to cyberpunk theme
picker.setOptions({ ui: { theme: 'cyberpunk' } });

Theme Examples

#

Material Design 3

index.ts
import 'timepicker-ui/main.css';
import 'timepicker-ui/theme-m3-green.css';
const picker = new TimepickerUI(input, {
ui: {
theme: 'm3-green',
animation: true
},
clock: {
type: '12h'
}
});

Glassmorphic

index.ts
import 'timepicker-ui/main.css';
import 'timepicker-ui/theme-glassmorphic.css';
const picker = new TimepickerUI(input, {
ui: {
theme: 'glassmorphic',
backdrop: true,
animation: true
}
});

Cyberpunk

index.ts
import 'timepicker-ui/main.css';
import 'timepicker-ui/theme-cyberpunk.css';
const picker = new TimepickerUI(input, {
ui: {
theme: 'cyberpunk',
animation: true,
backdrop: true
},
clock: {
type: '24h'
}
});

Blueprint New in v4.4.0

A precision-instrument look with a vivid cobalt accent and hairline borders. Use blueprint for light surfaces or blueprint-dark for the navy dark sibling.

index.ts
import 'timepicker-ui/main.css';
import 'timepicker-ui/theme-blueprint.css';
const picker = new TimepickerUI(input, {
ui: {
theme: 'blueprint',
animation: true
}
});
// Dark sibling
// import 'timepicker-ui/theme-blueprint-dark.css';
// ui: { theme: 'blueprint-dark' }
Custom Themes
You can create custom themes by overriding CSS variables or creating your own theme file. Check the documentation for detailed instructions on custom styling.
Learn about custom styling
Esc