Comparing version 0.0.3 to 0.0.4
import { CString } from 'bun:ffi'; | ||
declare type Pointer = number; | ||
declare type BlipglossColor = ReturnType<typeof Color>; | ||
declare type BlipglossColor = string; | ||
declare class Style { | ||
@@ -45,3 +44,2 @@ #private; | ||
declare function NewStyle(): Style; | ||
declare function Color(color: string): Pointer; | ||
/** | ||
@@ -52,2 +50,2 @@ * Returns whether or not the terminal has a dark background. | ||
export { Color, HasDarkBackground, NewStyle, Style }; | ||
export { HasDarkBackground, NewStyle, Style }; |
@@ -41,3 +41,2 @@ "use strict"; | ||
__export(src_exports, { | ||
Color: () => Color, | ||
HasDarkBackground: () => HasDarkBackground, | ||
@@ -55,3 +54,10 @@ NewStyle: () => NewStyle, | ||
var import_meta = {}; | ||
var location = new URL(`../release/${process.platform}-${process.arch}`, import_meta.url).pathname; | ||
var { platform, arch } = process; | ||
var filename; | ||
if (arch === "x64") { | ||
filename = `../release/blipgloss-${platform}-amd64.${import_bun_ffi.suffix}`; | ||
} else { | ||
filename = `../release/blipgloss-${platform}-${arch}.${import_bun_ffi.suffix}`; | ||
} | ||
var location = new URL(filename, import_meta.url).pathname; | ||
var { symbols } = (0, import_bun_ffi.dlopen)(location, { | ||
@@ -94,6 +100,2 @@ NewStyle: { | ||
}, | ||
Color: { | ||
args: [import_bun_ffi.FFIType.ptr], | ||
returns: import_bun_ffi.FFIType.ptr | ||
}, | ||
HasDarkBackground: { | ||
@@ -127,3 +129,3 @@ args: [], | ||
SetColorValue(key, value) { | ||
symbols.SetColorValue(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(key)), value); | ||
symbols.SetColorValue(__privateGet(this, _handle), (0, import_bun_ffi3.ptr)(encode(key)), (0, import_bun_ffi3.ptr)(encode(value))); | ||
return this; | ||
@@ -242,5 +244,2 @@ } | ||
} | ||
function Color(color) { | ||
return symbols.Color((0, import_bun_ffi3.ptr)(encode(color))); | ||
} | ||
function HasDarkBackground() { | ||
@@ -251,3 +250,2 @@ return symbols.HasDarkBackground(); | ||
0 && (module.exports = { | ||
Color, | ||
HasDarkBackground, | ||
@@ -254,0 +252,0 @@ NewStyle, |
{ | ||
"name": "blipgloss", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
@@ -16,8 +16,8 @@ # blipgloss | ||
```ts | ||
import { NewStyle, Color } from 'blipgloss' | ||
import { NewStyle } from 'blipgloss' | ||
const style = NewStyle() | ||
.Bold(true) | ||
.Foreground(Color("#FAFAFA")) | ||
.Background(Color("#7D56F4")) | ||
.Foreground("#FAFAFA") | ||
.Background("#7D56F4") | ||
.PaddingTop(2) | ||
@@ -30,2 +30,4 @@ .PaddingLeft(4) | ||
<img src="https://i.imgur.com/TKhvhlR.png" alt="demo" width="300" /> | ||
## Colors | ||
@@ -38,5 +40,5 @@ | ||
```js | ||
Color("5") // magenta | ||
Color("9") // red | ||
Color("12") // light blue | ||
Background("5") // magenta | ||
Background("9") // red | ||
Background("12") // light blue | ||
``` | ||
@@ -47,5 +49,5 @@ | ||
```js | ||
Color("86") // aqua | ||
Color("201") // hot pink | ||
Color("202") // orange | ||
Background("86") // aqua | ||
Background("201") // hot pink | ||
Background("202") // orange | ||
``` | ||
@@ -56,5 +58,5 @@ | ||
```js | ||
Color("#0000FF") // good ol' 100% blue | ||
Color("#04B575") // a green | ||
Color("#3C3C3C") // a dark gray | ||
Background("#0000FF") // good ol' 100% blue | ||
Background("#04B575") // a green | ||
Background("#3C3C3C") // a dark gray | ||
``` | ||
@@ -117,3 +119,3 @@ | ||
.Height(32) | ||
.Foreground(Color("63")) | ||
.Foreground("63") | ||
.Render("What’s for lunch?") | ||
@@ -120,0 +122,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
10540963
14
137
505
4