Comparing version
// Generated by dts-bundle-generator v8.0.1 | ||
export type BlipglossColor = string | { | ||
export type AdaptiveColor = { | ||
Light: string; | ||
Dark: string; | ||
}; | ||
export type CompleteColor = { | ||
True: string; | ||
ANSI256: string; | ||
ANSI: string; | ||
}; | ||
export type BlipglossColor = string | AdaptiveColor | CompleteColor; | ||
export declare enum Position { | ||
@@ -8,0 +14,0 @@ Top = 0, |
@@ -28,3 +28,3 @@ // src/lib.ts | ||
SetColorValue: { | ||
args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.bool], | ||
args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.int], | ||
returns: FFIType.void | ||
@@ -155,5 +155,13 @@ }, | ||
SetColorValue(key, value) { | ||
const adaptive = typeof value !== "string"; | ||
const color = adaptive ? ptr(encode(JSON.stringify(value))) : ptr(encode(value)); | ||
symbols.SetColorValue(this.#handle, ptr(encode(key)), color, adaptive); | ||
const isObject = typeof value !== "string"; | ||
const color = isObject ? ptr(encode(JSON.stringify(value))) : ptr(encode(value)); | ||
if (isObject) { | ||
if ("Light" in value) { | ||
symbols.SetColorValue(this.#handle, ptr(encode(key)), color, 2); | ||
} else { | ||
symbols.SetColorValue(this.#handle, ptr(encode(key)), color, 3); | ||
} | ||
} else { | ||
symbols.SetColorValue(this.#handle, ptr(encode(key)), color, 1); | ||
} | ||
return this; | ||
@@ -160,0 +168,0 @@ } |
{ | ||
"name": "blipgloss", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -74,2 +74,14 @@ # blipgloss | ||
### Complete Colors | ||
CompleteColor specifies exact values for truecolor, ANSI256, and ANSI color profiles. | ||
```js | ||
Background({ | ||
True: "#0000FF", | ||
ANSI256: "86", | ||
ANSI: "5" | ||
}) | ||
``` | ||
The terminal's background color will automatically be detected and the appropriate color will be chosen at runtime. | ||
@@ -76,0 +88,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
14054849
0.03%287
4.36%13
-7.14%452
-43.92%