@kolkrabbi/kol-styleguide 0.18.1 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/ColorLab.jsx +21 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-styleguide",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Brand guide components and the brand tool",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@kolkrabbi/kol-icons": "^0.53.1",
|
|
26
25
|
"@kolkrabbi/kol-print": "^0.1.1",
|
|
27
|
-
"@kolkrabbi/kol-
|
|
28
|
-
"@kolkrabbi/kol-
|
|
29
|
-
"@kolkrabbi/kol-
|
|
26
|
+
"@kolkrabbi/kol-theme": "^0.200.2",
|
|
27
|
+
"@kolkrabbi/kol-framework": "^0.65.0",
|
|
28
|
+
"@kolkrabbi/kol-component": "^0.317.2",
|
|
29
|
+
"@kolkrabbi/kol-icons": "^0.53.2"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"src",
|
package/src/ColorLab.jsx
CHANGED
|
@@ -261,10 +261,10 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
261
261
|
/* HARMONIES (review 3): the DS's glyphs, each named on hover, the mode named in the label — on the Wheel tab only
|
|
262
262
|
* (review 6 — *"you know there is a tab for wheel. why do you put it on every page?"*) */
|
|
263
263
|
<>
|
|
264
|
-
{/*
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
264
|
+
{/* THE EYEBROW IS THE RAIL'S LABEL (review 8 — *"IT WAS PERFECT!!! I was saying why is it only used here"*): the
|
|
265
|
+
* settings rail's section label, now on every label in the rail */}
|
|
266
|
+
<p className="kol-eyebrow text-fg-80">Harmony: {harmonyLabel(c.relation)}</p>
|
|
267
|
+
{/* review 5 — bigger glyphs across the rail's width, no chip, OPAQUE ink (oq, never fg), full when chosen */}
|
|
268
268
|
<div className="grid w-full grid-cols-9">
|
|
269
269
|
{HARMONY_TILES.map((id) => (
|
|
270
270
|
<Tooltip key={id} label={harmonyLabel(id)}>
|
|
@@ -303,7 +303,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
303
303
|
<span className="relative flex flex-col items-center gap-2">
|
|
304
304
|
<Button size="md" tone="inverted" iconLeft="upload" onClick={(e) => { e.stopPropagation(); fileInput.current?.click() }}>Upload your image</Button>
|
|
305
305
|
<span className="kol-sans-body-02 text-emphasis">Or drag and drop here</span>
|
|
306
|
-
<span className="kol-sans-body-
|
|
306
|
+
<span className="whitespace-nowrap kol-sans-body-03 text-meta">File must be JPEG, JPG, PNG or WebP and up to 40MB</span>
|
|
307
307
|
</span>
|
|
308
308
|
)}
|
|
309
309
|
<input ref={fileInput} type="file" accept="image/jpeg,image/png,image/webp" className="hidden" onChange={(e) => { fromFile(e.target.files?.[0]); e.target.value = '' }} />
|
|
@@ -410,7 +410,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
410
410
|
/* the pair, Adobe's: Foreground and Background side by side, swap between them, each colour's lightness under it */
|
|
411
411
|
const pairCol = (label, i, key) => (
|
|
412
412
|
<div className="flex min-w-0 flex-col gap-2">
|
|
413
|
-
<span className="kol-
|
|
413
|
+
<span className="kol-eyebrow text-fg-80">{label}</span>
|
|
414
414
|
<div className="flex items-center gap-2">
|
|
415
415
|
<span className="size-4 shrink-0 rounded-full" style={{ background: c.colors[i] }} />
|
|
416
416
|
<Dropdown size="sm" value={String(i)} onChange={(v) => setPair({ fg: fgI, bg: bgI, [key]: Number(v) })} options={colourOptions} className="min-w-0 flex-1" ariaLabel={`${label} colour`} />
|
|
@@ -421,7 +421,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
421
421
|
const pairHead = (
|
|
422
422
|
<div className="flex flex-col gap-4">
|
|
423
423
|
<div className="flex items-center justify-between gap-3">
|
|
424
|
-
<span className="kol-
|
|
424
|
+
<span className="kol-eyebrow text-fg-80">Contrast ratio</span>
|
|
425
425
|
<span className={`inline-flex items-center gap-1 rounded px-2 py-0.5 kol-mono-12 ${ratio >= 4.5 ? 'bg-oq-08 text-emphasis' : 'bg-oq-04 text-meta'}`}><Icon name={ratio >= 4.5 ? 'check' : 'alert-triangle'} size={12} className={ratio >= 4.5 ? 'text-oq-96' : 'text-oq-48'} />{ratioText(ratio)} : 1</span>
|
|
426
426
|
</div>
|
|
427
427
|
<div className="grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-start gap-2">
|
|
@@ -433,7 +433,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
433
433
|
)
|
|
434
434
|
const summaryTable = (
|
|
435
435
|
<div className="flex flex-col">
|
|
436
|
-
<div className="grid grid-cols-[minmax(0,1fr)_64px_64px] border-b border-oq-16 pb-2 kol-
|
|
436
|
+
<div className="grid grid-cols-[minmax(0,1fr)_64px_64px] border-b border-oq-16 pb-2 kol-eyebrow text-fg-80"><span>Category</span><span>AA</span><span>AAA</span></div>
|
|
437
437
|
{SUMMARY.map((r) => (
|
|
438
438
|
<div key={r.id} className="grid grid-cols-[minmax(0,1fr)_64px_64px] items-center border-b border-oq-08 py-3 kol-sans-body-02 text-emphasis"><span>{r.label}</span><Verdict ok={r.aa} /><Verdict ok={r.aaa} na={r.aaa === null} /></div>
|
|
439
439
|
))}
|
|
@@ -442,7 +442,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
442
442
|
/* KOL's text levels: the foreground at every ink stop over the background, each measured */
|
|
443
443
|
const ladder = (
|
|
444
444
|
<div className="flex flex-col gap-2">
|
|
445
|
-
<span className="kol-
|
|
445
|
+
<span className="kol-eyebrow text-fg-80">Text levels</span>
|
|
446
446
|
<div className="flex w-full flex-col rounded p-3" style={{ background: bg }}>
|
|
447
447
|
{c.text.map((x) => {
|
|
448
448
|
const r = contrastRatio(over(fg, bg, x.stop / 100), bg)
|
|
@@ -463,7 +463,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
463
463
|
<>
|
|
464
464
|
{pairHead}
|
|
465
465
|
<div className="flex flex-col">
|
|
466
|
-
<span className="border-b border-oq-16 pb-2 kol-
|
|
466
|
+
<span className="border-b border-oq-16 pb-2 kol-eyebrow text-fg-80">Foreground colors that pass AA</span>
|
|
467
467
|
{suggestions.length === 0 && <span className="py-3 kol-sans-body-02 text-meta">None at this hue. Move the background’s lightness.</span>}
|
|
468
468
|
{suggestions.map((x) => (
|
|
469
469
|
<button key={x.hex} type="button" onClick={() => editAt(fgI, x.hex)} className="grid cursor-pointer grid-cols-[16px_minmax(0,1fr)_auto] items-center gap-3 border-b border-oq-08 py-2 text-left kol-mono-12 text-emphasis hover:bg-oq-04">
|
|
@@ -477,23 +477,27 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
477
477
|
<>
|
|
478
478
|
{pairHead}
|
|
479
479
|
<div className="flex flex-col gap-2">
|
|
480
|
-
<span className="kol-
|
|
480
|
+
<span className="kol-eyebrow text-fg-80">Target ratio</span>
|
|
481
481
|
<Slider className="w-full" min={1} max={21} step={0.5} value={target ?? Math.round(ratio * 2) / 2} onChange={(t) => { setTarget(t); editAt(fgI, solveFor(t)) }} readout="input" displayWidth={4} readoutPreset="rail" aria-label="Target contrast ratio" />
|
|
482
482
|
<span className="kol-sans-body-02 text-meta">The foreground’s lightness moves until the pair reaches it.</span>
|
|
483
483
|
</div>
|
|
484
484
|
</>
|
|
485
485
|
) },
|
|
486
486
|
]
|
|
487
|
-
|
|
487
|
+
/* THE PREVIEW IN THE PALETTE'S OWN FORMS (review 8 — *"how is this using ANYTHING but the colors?? … show some
|
|
488
|
+
* forms that use the pallette"*): the page in bg and fg, the other colours as forms beside the text; the DS Button */
|
|
489
|
+
const FORMS = ['left-[8%] top-[10%] w-[52%] aspect-square rounded-full', 'right-[8%] bottom-[8%] w-[38%] aspect-square rounded-[12%]', 'left-[6%] bottom-[12%] h-[14%] w-[48%] rounded-full', 'right-[10%] top-[8%] h-[9%] w-[32%] rounded']
|
|
490
|
+
const forms = c.colors.filter((_, i) => i !== fgI && i !== bgI)
|
|
488
491
|
const contrastStage = (
|
|
489
|
-
/* ADOBE'S PREVIEW: the image beside the pair as a page would use it — a headline, body text and a button */
|
|
490
492
|
<div className="flex h-full min-h-[240px] flex-col gap-3">
|
|
491
|
-
<div className=
|
|
492
|
-
|
|
493
|
+
<div className="grid min-h-0 flex-1 grid-cols-2 grid-rows-[minmax(0,1fr)] overflow-hidden rounded" style={{ background: bg, color: fg }}>
|
|
494
|
+
<div className="relative min-h-0 overflow-hidden">
|
|
495
|
+
{(forms.length ? forms : [fg]).slice(0, 4).map((hex, i) => <span key={`${hex}${i}`} className={`absolute ${FORMS[i]}`} style={{ background: hex }} />)}
|
|
496
|
+
</div>
|
|
493
497
|
<div className="flex min-h-0 flex-col justify-center gap-6 p-10">
|
|
494
498
|
<span className="kol-sans-heading-01 leading-none">The quick brown fox</span>
|
|
495
499
|
<span className="max-w-[48ch] kol-sans-body-02">Body text in the foreground on the background, the size most of a page is read at. If this line is hard to read, so is the page.</span>
|
|
496
|
-
<
|
|
500
|
+
<Button size="md" className="self-start" style={{ '--kol-tone-bg': fg, '--kol-tone-hover-bg': fg, '--kol-tone-fg': bg, '--kol-tone-hover-fg': bg, '--kol-tone-image': 'none', '--kol-tone-hover-image': 'none' }}>Button</Button>
|
|
497
501
|
</div>
|
|
498
502
|
</div>
|
|
499
503
|
{paletteFoot}
|
|
@@ -510,7 +514,7 @@ export default function ColorLab({ value: valueProp, onChange, samples = [], lib
|
|
|
510
514
|
const visionRail = [{ id: 'conflicts', label: 'Conflicts', content: (
|
|
511
515
|
<>
|
|
512
516
|
<div className="flex items-center justify-between gap-3 rounded bg-oq-04 p-3">
|
|
513
|
-
<span className="kol-
|
|
517
|
+
<span className="kol-eyebrow text-fg-80">Potential color blind conflicts</span>
|
|
514
518
|
<span className={`inline-flex shrink-0 items-center gap-1 rounded px-2 py-0.5 kol-mono-12 ${conflicts ? 'bg-oq-08 text-emphasis' : 'text-meta'}`}>{conflicts && <Icon name="alert-triangle" size={12} className="text-oq-96" />}{conflicts ? 'Conflicts found' : 'None'}</span>
|
|
515
519
|
</div>
|
|
516
520
|
<PaletteDots colors={c.colors} />
|