Skip to content

Commit

Permalink
fix: incorrect condition guards for complete adaptive colors
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano committed Sep 18, 2023
1 parent e5f05d6 commit efa45f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,19 @@ export class Style {
const isObject = typeof value !== 'string'
const color = isObject ? ptr(encode(JSON.stringify(value))) : ptr(encode(value))

if (!isObject){
if (!isObject) {
// value is of type string
symbols.SetColorValue(this.#handle, ptr(encode(key)), color, 1)
return this
}

if ('Light' in value && 'Dark' in value) {
if (
// @ts-expect-error: Better type checking
typeof value.Light !== 'string' &&
'True' in value.Light &&
'ANSI256' in value.Light &&
'ANSI' in value.Light &&
// @ts-expect-error: Better type checking
typeof value.Dark !== 'string' &&
'True' in value.Dark &&
'ANSI256' in value.Dark &&
'ANSI' in value.Dark
Expand Down

0 comments on commit efa45f9

Please sign in to comment.