Comparing version 0.1.0 to 0.1.1
import { CString } from 'bun:ffi'; | ||
declare type BlipglossColor = string; | ||
declare type BlipglossColor = string | { | ||
Light: string; | ||
Dark: string; | ||
}; | ||
declare class Style { | ||
@@ -5,0 +8,0 @@ #private; |
@@ -75,3 +75,3 @@ "use strict"; | ||
SetColorValue: { | ||
args: [import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr], | ||
args: [import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.ptr, import_bun_ffi.FFIType.bool], | ||
returns: import_bun_ffi.FFIType.void | ||
@@ -131,3 +131,5 @@ }, | ||
SetColorValue(key, value) { | ||
symbols.SetColorValue(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(key)), (0, import_bun_ffi3.ptr)(encode(value))); | ||
const adaptive = typeof value !== "string"; | ||
const color = adaptive ? (0, import_bun_ffi3.ptr)(encode(JSON.stringify(value))) : (0, import_bun_ffi3.ptr)(encode(value)); | ||
symbols.SetColorValue(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(key)), color, adaptive); | ||
return this; | ||
@@ -134,0 +136,0 @@ } |
{ | ||
"name": "blipgloss", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
@@ -13,3 +13,3 @@ # blipgloss | ||
Blipgloss takes an expressive, declarative approach to terminal rendering. Users familiar with CSS will feel at home with Blipgloss. | ||
Blipgloss takes an expressive, declarative approach to terminal rendering. Users familiar with CSS will feel at home with B | ||
@@ -64,2 +64,15 @@ ```ts | ||
### Adaptive Colors | ||
You can also specify color options for light and dark backgrounds: | ||
```js | ||
Background({ | ||
Light: '236', | ||
Dark: '248' | ||
}) | ||
``` | ||
The terminal's background color will automatically be detected and the appropriate color will be chosen at runtime. | ||
## Inline Formatting | ||
@@ -113,3 +126,3 @@ | ||
```js | ||
const str = lipgloss.NewStyle() | ||
const str = NewStyle() | ||
.Width(24) | ||
@@ -130,3 +143,3 @@ .Height(32) | ||
```js | ||
const style = lipgloss.NewStyle().Foreground("219") | ||
const style = NewStyle().Foreground("219") | ||
@@ -143,3 +156,3 @@ const wildStyle = style.Copy().Blink(true) | ||
```js | ||
const style = lipgloss.NewStyle(). | ||
const style = NewStyle(). | ||
Bold(true). // make it bold | ||
@@ -146,0 +159,0 @@ UnsetBold(). // jk don't make it bold |
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
Sorry, the diff of this file is not supported yet
11318570
590
170