File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ declare module '*?worker' {
1111 export default worker
1212}
1313
14+ declare module '*.svg?url' {
15+ let image : string
16+ export default image
17+ }
18+
1419declare const COLOR_FN : 'lch' | 'oklch'
1520declare const LCH : boolean
1621declare const L_MAX : number
Original file line number Diff line number Diff line change 1+ import { formatLch } from '../../lib/colors.ts'
12import { isHotkey } from '../../lib/hotkeys.ts'
23import { accent } from '../../stores/accent.ts'
4+ import { current , valueToColor } from '../../stores/current.ts'
35import { redo , undo } from '../../stores/history.ts'
46import { loading } from '../../stores/loading.ts'
7+ import simpleLogo from './simple.svg?url'
58
69// The only way to detect Mac is using old API
710// eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -35,3 +38,16 @@ document.body.addEventListener('keydown', e => {
3538 undo ( )
3639 }
3740} )
41+
42+ if ( COLOR_FN === 'oklch' ) {
43+ let iconLink = document . querySelector < HTMLLinkElement > (
44+ 'link[rel="icon"][type="image/svg+xml"]'
45+ )
46+ current . subscribe ( value => {
47+ let colorLogo = simpleLogo . replace ( '%23000' , formatLch ( valueToColor ( value ) ) )
48+ if ( value . l > 0.9 ) {
49+ colorLogo = colorLogo . replace ( '%23fff' , '%23000' )
50+ }
51+ iconLink ?. setAttribute ( 'href' , colorLogo )
52+ } )
53+ }
You can’t perform that action at this time.
0 commit comments