11import * as Popover from '@radix-ui/react-popover'
22import { themeGet } from '../../../lib'
33import { useTheme } from '../../providers/ThemeContext'
4+ import { joinPath } from '../../providers/util'
45import Checkerboard from './Checkerboard'
56import { hasAlpha , withFallback } from './util'
67
@@ -20,6 +21,15 @@ export default function PalettePopover({
2021 // swatch,
2122 ...props
2223} : Props ) {
24+ const theme = useTheme ( )
25+ const rawValue = themeGet ( {
26+ property : 'color' ,
27+ path : value . path ,
28+ theme,
29+ } )
30+
31+ const labelMeta = value . path === rawValue ? null : `(${ rawValue } )`
32+
2333 return (
2434 < Popover . Root >
2535 < Popover . Trigger
@@ -46,6 +56,7 @@ export default function PalettePopover({
4656 { /* swatch */ }
4757 < Popover . Anchor > { < Swatch value = { value } /> } </ Popover . Anchor >
4858 { value . path }
59+ < span sx = { { fontSize : 0 , color : 'muted' } } > { labelMeta } </ span >
4960 </ Popover . Trigger >
5061 < Popover . Content
5162 sx = { {
@@ -114,12 +125,18 @@ export function PalettePicker({ value, onChange }: Props) {
114125 return (
115126 < div key = { name } sx = { { display : 'flex' , gap : '.125rem' } } >
116127 { ( colorGroup as any ) . map ( ( color : any , i : number ) => {
128+ const colorPath = `${ name } .${ i } `
117129 const selected = valueColor === color
130+ const rawColor = themeGet ( {
131+ theme,
132+ property : 'color' ,
133+ path : colorPath ,
134+ } )
118135
119136 return (
120137 < button
121138 key = { color . id }
122- title = { `${ name } . ${ i } ` }
139+ title = { `${ colorPath } ( ${ rawColor } ) ` }
123140 sx = { {
124141 appearance : 'none' ,
125142 WebkitAppearance : 'none' ,
0 commit comments