lipgloss 0.2.2-aarch64-linux-gnu → 0.2.3-aarch64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/ext/lipgloss/extension.c +17 -0
- data/ext/lipgloss/style.c +11 -0
- data/ext/lipgloss/table.c +29 -9
- data/go/build/linux_arm64/liblipgloss.a +0 -0
- data/go/build/linux_arm64/liblipgloss.h +5 -0
- data/go/go.mod +5 -3
- data/go/layout.go +16 -0
- data/go/style_hash.go +144 -0
- data/lib/lipgloss/3.2/lipgloss.so +0 -0
- data/lib/lipgloss/3.3/lipgloss.so +0 -0
- data/lib/lipgloss/3.4/lipgloss.so +0 -0
- data/lib/lipgloss/4.0/lipgloss.so +0 -0
- data/lib/lipgloss/style.rb +5 -0
- data/lib/lipgloss/version.rb +1 -1
- data/lib/lipgloss.rb +21 -0
- data/sig/lipgloss/lipgloss.rbs +7 -3
- data/sig/lipgloss/style.rbs +3 -0
- data/sig/lipgloss.rbs +11 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f5ce5146c473b1e9703959a4668664a490a46a9a6e18db087b6d71333ed613c
|
|
4
|
+
data.tar.gz: 5dcbb3233b43d36091f9daa653dd02cf6ccf63299f402896bbdfc2843ae5e1e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2659866e8152b4ea16d341129176b780ed0d88adc5f5cf748f6ef1c2a49b4fb81a65631ffe4b9dd0a84983884321a96e28e0eda5f43de9f926f51daee6672fd6
|
|
7
|
+
data.tar.gz: 047c5ca1a9a2fe4276ae4c46ef204e7966d95cf76b9b789948b7e75e018fea76eb4bed71225a825de581b1b3e715f6f1356e9eed6e92c88b905489185c8b0978
|
data/README.md
CHANGED
|
@@ -176,6 +176,17 @@ color = Lipgloss::CompleteAdaptiveColor.new(light: light, dark: dark)
|
|
|
176
176
|
style = Lipgloss::Style.new.foreground(color)
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
+
**Color profile:**
|
|
180
|
+
|
|
181
|
+
Lip Gloss detects how many colors the terminal supports when it first renders. Set the profile to force colors on, for example in CI or golden tests, or off:
|
|
182
|
+
|
|
183
|
+
```ruby
|
|
184
|
+
Lipgloss.color_profile # => :true_color, :ansi256, :ansi, or :ascii
|
|
185
|
+
Lipgloss.color_profile = :true_color # always render colors
|
|
186
|
+
Lipgloss.color_profile = :ascii # never render colors
|
|
187
|
+
Lipgloss.has_dark_background = true # pick the dark variant of adaptive colors
|
|
188
|
+
```
|
|
189
|
+
|
|
179
190
|
### Style Inheritance
|
|
180
191
|
|
|
181
192
|
**Inherit styles from a parent:**
|
|
@@ -415,6 +426,9 @@ puts tree.render
|
|
|
415
426
|
| `Lipgloss.place_horizontal(width, position, string)` | Place horizontally |
|
|
416
427
|
| `Lipgloss.place_vertical(height, position, string)` | Place vertically |
|
|
417
428
|
| `Lipgloss.has_dark_background?` | Check terminal background |
|
|
429
|
+
| `Lipgloss.has_dark_background = bool` | Set terminal background |
|
|
430
|
+
| `Lipgloss.color_profile` | Get the color profile |
|
|
431
|
+
| `Lipgloss.color_profile = profile` | Set the color profile |
|
|
418
432
|
|
|
419
433
|
### Color Blending
|
|
420
434
|
|
data/ext/lipgloss/extension.c
CHANGED
|
@@ -150,6 +150,20 @@ static VALUE lipgloss_has_dark_background_rb(VALUE self) {
|
|
|
150
150
|
return lipgloss_has_dark_background() ? Qtrue : Qfalse;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
static VALUE lipgloss_color_profile_rb(VALUE self) {
|
|
154
|
+
return INT2NUM(lipgloss_color_profile());
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static VALUE lipgloss_set_color_profile_rb(VALUE self, VALUE profile) {
|
|
158
|
+
lipgloss_set_color_profile(NUM2INT(profile));
|
|
159
|
+
return profile;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static VALUE lipgloss_set_has_dark_background_rb(VALUE self, VALUE dark) {
|
|
163
|
+
lipgloss_set_has_dark_background(RTEST(dark) ? 1 : 0);
|
|
164
|
+
return dark;
|
|
165
|
+
}
|
|
166
|
+
|
|
153
167
|
static VALUE lipgloss_upstream_version_rb(VALUE self) {
|
|
154
168
|
char *version = lipgloss_upstream_version();
|
|
155
169
|
VALUE rb_version = rb_utf8_str_new_cstr(version);
|
|
@@ -187,6 +201,9 @@ __attribute__((__visibility__("default"))) void Init_lipgloss(void) {
|
|
|
187
201
|
rb_define_singleton_method(mLipgloss, "_place_horizontal", lipgloss_place_horizontal_rb, 3);
|
|
188
202
|
rb_define_singleton_method(mLipgloss, "_place_vertical", lipgloss_place_vertical_rb, 3);
|
|
189
203
|
rb_define_singleton_method(mLipgloss, "has_dark_background?", lipgloss_has_dark_background_rb, 0);
|
|
204
|
+
rb_define_singleton_method(mLipgloss, "has_dark_background=", lipgloss_set_has_dark_background_rb, 1);
|
|
205
|
+
rb_define_singleton_method(mLipgloss, "_color_profile", lipgloss_color_profile_rb, 0);
|
|
206
|
+
rb_define_singleton_method(mLipgloss, "_set_color_profile", lipgloss_set_color_profile_rb, 1);
|
|
190
207
|
rb_define_singleton_method(mLipgloss, "upstream_version", lipgloss_upstream_version_rb, 0);
|
|
191
208
|
rb_define_singleton_method(mLipgloss, "version", lipgloss_version_rb, 0);
|
|
192
209
|
}
|
data/ext/lipgloss/style.c
CHANGED
|
@@ -344,6 +344,16 @@ static VALUE style_to_s(VALUE self) {
|
|
|
344
344
|
return rb_result;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
static VALUE style_to_json(VALUE self) {
|
|
348
|
+
GET_STYLE(self, style);
|
|
349
|
+
char *result = lipgloss_style_to_json(style->handle);
|
|
350
|
+
VALUE rb_result = rb_utf8_str_new_cstr(result);
|
|
351
|
+
|
|
352
|
+
lipgloss_free(result);
|
|
353
|
+
|
|
354
|
+
return rb_result;
|
|
355
|
+
}
|
|
356
|
+
|
|
347
357
|
// Getter methods
|
|
348
358
|
|
|
349
359
|
static VALUE style_get_bold(VALUE self) {
|
|
@@ -455,6 +465,7 @@ void Init_lipgloss_style(void) {
|
|
|
455
465
|
rb_define_method(cStyle, "set_string", style_set_string, 1);
|
|
456
466
|
rb_define_method(cStyle, "inherit", style_inherit, 1);
|
|
457
467
|
rb_define_method(cStyle, "to_s", style_to_s, 0);
|
|
468
|
+
rb_define_method(cStyle, "_to_json", style_to_json, 0);
|
|
458
469
|
|
|
459
470
|
rb_define_method(cStyle, "bold?", style_get_bold, 0);
|
|
460
471
|
rb_define_method(cStyle, "italic?", style_get_italic, 0);
|
data/ext/lipgloss/table.c
CHANGED
|
@@ -40,29 +40,49 @@ static VALUE table_initialize(VALUE self) {
|
|
|
40
40
|
return self;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
static VALUE table_cells_to_s(VALUE cells) {
|
|
44
|
+
Check_Type(cells, T_ARRAY);
|
|
45
|
+
|
|
46
|
+
long length = RARRAY_LEN(cells);
|
|
47
|
+
VALUE result = rb_ary_new_capa(length);
|
|
48
|
+
|
|
49
|
+
for (long index = 0; index < length; index++) {
|
|
50
|
+
rb_ary_push(result, rb_obj_as_string(rb_ary_entry(cells, index)));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static VALUE table_rows_to_s(VALUE rows) {
|
|
57
|
+
Check_Type(rows, T_ARRAY);
|
|
58
|
+
|
|
59
|
+
long length = RARRAY_LEN(rows);
|
|
60
|
+
VALUE result = rb_ary_new_capa(length);
|
|
61
|
+
|
|
62
|
+
for (long index = 0; index < length; index++) {
|
|
63
|
+
rb_ary_push(result, table_cells_to_s(rb_ary_entry(rows, index)));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
|
|
43
69
|
static VALUE table_headers(VALUE self, VALUE headers) {
|
|
44
70
|
GET_TABLE(self, table);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
VALUE json_str = rb_funcall(headers, rb_intern("to_json"), 0);
|
|
71
|
+
VALUE json_str = rb_funcall(table_cells_to_s(headers), rb_intern("to_json"), 0);
|
|
48
72
|
unsigned long long new_handle = lipgloss_table_headers(table->handle, StringValueCStr(json_str));
|
|
49
73
|
return table_wrap(rb_class_of(self), new_handle);
|
|
50
74
|
}
|
|
51
75
|
|
|
52
76
|
static VALUE table_row(VALUE self, VALUE row) {
|
|
53
77
|
GET_TABLE(self, table);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
VALUE json_str = rb_funcall(row, rb_intern("to_json"), 0);
|
|
78
|
+
VALUE json_str = rb_funcall(table_cells_to_s(row), rb_intern("to_json"), 0);
|
|
57
79
|
unsigned long long new_handle = lipgloss_table_row(table->handle, StringValueCStr(json_str));
|
|
58
80
|
return table_wrap(rb_class_of(self), new_handle);
|
|
59
81
|
}
|
|
60
82
|
|
|
61
83
|
static VALUE table_rows(VALUE self, VALUE rows) {
|
|
62
84
|
GET_TABLE(self, table);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
VALUE json_str = rb_funcall(rows, rb_intern("to_json"), 0);
|
|
85
|
+
VALUE json_str = rb_funcall(table_rows_to_s(rows), rb_intern("to_json"), 0);
|
|
66
86
|
unsigned long long new_handle = lipgloss_table_rows(table->handle, StringValueCStr(json_str));
|
|
67
87
|
|
|
68
88
|
return table_wrap(rb_class_of(self), new_handle);
|
|
Binary file
|
|
@@ -35,6 +35,7 @@ typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
|
|
38
39
|
/* End of preamble from import "C" comments. */
|
|
39
40
|
|
|
40
41
|
|
|
@@ -103,6 +104,9 @@ extern char* lipgloss_place_with_whitespace_adaptive(int width, int height, doub
|
|
|
103
104
|
extern char* lipgloss_place_horizontal(int width, double position, char* text);
|
|
104
105
|
extern char* lipgloss_place_vertical(int height, double position, char* text);
|
|
105
106
|
extern int lipgloss_has_dark_background();
|
|
107
|
+
extern int lipgloss_color_profile();
|
|
108
|
+
extern void lipgloss_set_color_profile(int profile);
|
|
109
|
+
extern void lipgloss_set_has_dark_background(int dark);
|
|
106
110
|
extern void lipgloss_free(char* pointer);
|
|
107
111
|
extern char* lipgloss_upstream_version();
|
|
108
112
|
extern long long unsigned int lipgloss_list_new();
|
|
@@ -176,6 +180,7 @@ extern long long unsigned int lipgloss_style_border_top_background(long long uns
|
|
|
176
180
|
extern long long unsigned int lipgloss_style_border_right_background(long long unsigned int id, char* color);
|
|
177
181
|
extern long long unsigned int lipgloss_style_border_bottom_background(long long unsigned int id, char* color);
|
|
178
182
|
extern long long unsigned int lipgloss_style_border_left_background(long long unsigned int id, char* color);
|
|
183
|
+
extern char* lipgloss_style_to_json(long long unsigned int id);
|
|
179
184
|
extern long long unsigned int lipgloss_style_padding(long long unsigned int id, int* values, int count);
|
|
180
185
|
extern long long unsigned int lipgloss_style_padding_top(long long unsigned int id, int value);
|
|
181
186
|
extern long long unsigned int lipgloss_style_padding_right(long long unsigned int id, int value);
|
data/go/go.mod
CHANGED
|
@@ -2,7 +2,11 @@ module github.com/marcoroth/lipgloss-ruby/go
|
|
|
2
2
|
|
|
3
3
|
go 1.23.0
|
|
4
4
|
|
|
5
|
-
require
|
|
5
|
+
require (
|
|
6
|
+
github.com/charmbracelet/lipgloss v1.1.0
|
|
7
|
+
github.com/lucasb-eyer/go-colorful v1.2.0
|
|
8
|
+
github.com/muesli/termenv v0.16.0
|
|
9
|
+
)
|
|
6
10
|
|
|
7
11
|
require (
|
|
8
12
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
|
@@ -10,10 +14,8 @@ require (
|
|
|
10
14
|
github.com/charmbracelet/x/ansi v0.8.0 // indirect
|
|
11
15
|
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
|
|
12
16
|
github.com/charmbracelet/x/term v0.2.1 // indirect
|
|
13
|
-
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
|
14
17
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
15
18
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
|
16
|
-
github.com/muesli/termenv v0.16.0 // indirect
|
|
17
19
|
github.com/rivo/uniseg v0.4.7 // indirect
|
|
18
20
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
|
19
21
|
golang.org/x/sys v0.30.0 // indirect
|
data/go/layout.go
CHANGED
|
@@ -5,6 +5,7 @@ import "C"
|
|
|
5
5
|
import (
|
|
6
6
|
"encoding/json"
|
|
7
7
|
"github.com/charmbracelet/lipgloss"
|
|
8
|
+
"github.com/muesli/termenv"
|
|
8
9
|
)
|
|
9
10
|
|
|
10
11
|
//export lipgloss_join_horizontal
|
|
@@ -111,3 +112,18 @@ func lipgloss_has_dark_background() C.int {
|
|
|
111
112
|
|
|
112
113
|
return 0
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
//export lipgloss_color_profile
|
|
117
|
+
func lipgloss_color_profile() C.int {
|
|
118
|
+
return C.int(lipgloss.ColorProfile())
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//export lipgloss_set_color_profile
|
|
122
|
+
func lipgloss_set_color_profile(profile C.int) {
|
|
123
|
+
lipgloss.SetColorProfile(termenv.Profile(profile))
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//export lipgloss_set_has_dark_background
|
|
127
|
+
func lipgloss_set_has_dark_background(dark C.int) {
|
|
128
|
+
lipgloss.SetHasDarkBackground(dark != 0)
|
|
129
|
+
}
|
data/go/style_hash.go
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import "C"
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"encoding/json"
|
|
7
|
+
|
|
8
|
+
"github.com/charmbracelet/lipgloss"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func colorToValue(tc lipgloss.TerminalColor) any {
|
|
12
|
+
switch c := tc.(type) {
|
|
13
|
+
case nil, lipgloss.NoColor:
|
|
14
|
+
return nil
|
|
15
|
+
case lipgloss.Color:
|
|
16
|
+
if c == "" {
|
|
17
|
+
return nil
|
|
18
|
+
}
|
|
19
|
+
return string(c)
|
|
20
|
+
case lipgloss.AdaptiveColor:
|
|
21
|
+
return map[string]any{"light": c.Light, "dark": c.Dark}
|
|
22
|
+
case lipgloss.CompleteColor:
|
|
23
|
+
return map[string]any{"true_color": c.TrueColor, "ansi256": c.ANSI256, "ansi": c.ANSI}
|
|
24
|
+
case lipgloss.CompleteAdaptiveColor:
|
|
25
|
+
return map[string]any{
|
|
26
|
+
"light": map[string]any{"true_color": c.Light.TrueColor, "ansi256": c.Light.ANSI256, "ansi": c.Light.ANSI},
|
|
27
|
+
"dark": map[string]any{"true_color": c.Dark.TrueColor, "ansi256": c.Dark.ANSI256, "ansi": c.Dark.ANSI},
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return nil
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
func borderToValue(b lipgloss.Border) map[string]any {
|
|
34
|
+
return map[string]any{
|
|
35
|
+
"top": b.Top,
|
|
36
|
+
"bottom": b.Bottom,
|
|
37
|
+
"left": b.Left,
|
|
38
|
+
"right": b.Right,
|
|
39
|
+
"top_left": b.TopLeft,
|
|
40
|
+
"top_right": b.TopRight,
|
|
41
|
+
"bottom_left": b.BottomLeft,
|
|
42
|
+
"bottom_right": b.BottomRight,
|
|
43
|
+
"middle_left": b.MiddleLeft,
|
|
44
|
+
"middle_right": b.MiddleRight,
|
|
45
|
+
"middle": b.Middle,
|
|
46
|
+
"middle_top": b.MiddleTop,
|
|
47
|
+
"middle_bottom": b.MiddleBottom,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func setIf(h map[string]any, key string, value any) {
|
|
52
|
+
switch v := value.(type) {
|
|
53
|
+
case nil:
|
|
54
|
+
return
|
|
55
|
+
case bool:
|
|
56
|
+
if !v {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
case int:
|
|
60
|
+
if v == 0 {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
h[key] = value
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
func styleToHash(s lipgloss.Style) map[string]any {
|
|
68
|
+
h := map[string]any{}
|
|
69
|
+
|
|
70
|
+
setIf(h, "bold", s.GetBold())
|
|
71
|
+
setIf(h, "italic", s.GetItalic())
|
|
72
|
+
setIf(h, "underline", s.GetUnderline())
|
|
73
|
+
setIf(h, "strikethrough", s.GetStrikethrough())
|
|
74
|
+
setIf(h, "reverse", s.GetReverse())
|
|
75
|
+
setIf(h, "blink", s.GetBlink())
|
|
76
|
+
setIf(h, "faint", s.GetFaint())
|
|
77
|
+
setIf(h, "inline", s.GetInline())
|
|
78
|
+
|
|
79
|
+
setIf(h, "foreground", colorToValue(s.GetForeground()))
|
|
80
|
+
setIf(h, "background", colorToValue(s.GetBackground()))
|
|
81
|
+
|
|
82
|
+
setIf(h, "width", s.GetWidth())
|
|
83
|
+
setIf(h, "height", s.GetHeight())
|
|
84
|
+
setIf(h, "max_width", s.GetMaxWidth())
|
|
85
|
+
setIf(h, "max_height", s.GetMaxHeight())
|
|
86
|
+
|
|
87
|
+
if horizontal := s.GetAlignHorizontal(); horizontal != lipgloss.Left {
|
|
88
|
+
h["align_horizontal"] = float64(horizontal)
|
|
89
|
+
}
|
|
90
|
+
if vertical := s.GetAlignVertical(); vertical != lipgloss.Top {
|
|
91
|
+
h["align_vertical"] = float64(vertical)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if t, r, b, l := s.GetPadding(); t+r+b+l > 0 {
|
|
95
|
+
h["padding"] = []int{t, r, b, l}
|
|
96
|
+
}
|
|
97
|
+
if t, r, b, l := s.GetMargin(); t+r+b+l > 0 {
|
|
98
|
+
h["margin"] = []int{t, r, b, l}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
border, top, right, bottom, left := s.GetBorder()
|
|
102
|
+
if top || right || bottom || left {
|
|
103
|
+
h["border"] = borderToValue(border)
|
|
104
|
+
h["border_sides"] = []bool{top, right, bottom, left}
|
|
105
|
+
|
|
106
|
+
foregrounds := []any{
|
|
107
|
+
colorToValue(s.GetBorderTopForeground()),
|
|
108
|
+
colorToValue(s.GetBorderRightForeground()),
|
|
109
|
+
colorToValue(s.GetBorderBottomForeground()),
|
|
110
|
+
colorToValue(s.GetBorderLeftForeground()),
|
|
111
|
+
}
|
|
112
|
+
backgrounds := []any{
|
|
113
|
+
colorToValue(s.GetBorderTopBackground()),
|
|
114
|
+
colorToValue(s.GetBorderRightBackground()),
|
|
115
|
+
colorToValue(s.GetBorderBottomBackground()),
|
|
116
|
+
colorToValue(s.GetBorderLeftBackground()),
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
for _, c := range foregrounds {
|
|
120
|
+
if c != nil {
|
|
121
|
+
h["border_foreground"] = foregrounds
|
|
122
|
+
break
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for _, c := range backgrounds {
|
|
126
|
+
if c != nil {
|
|
127
|
+
h["border_background"] = backgrounds
|
|
128
|
+
break
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return h
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//export lipgloss_style_to_json
|
|
137
|
+
func lipgloss_style_to_json(id C.ulonglong) *C.char {
|
|
138
|
+
data, err := json.Marshal(styleToHash(getStyle(uint64(id))))
|
|
139
|
+
if err != nil {
|
|
140
|
+
return C.CString("{}")
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return C.CString(string(data))
|
|
144
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/lipgloss/style.rb
CHANGED
data/lib/lipgloss/version.rb
CHANGED
data/lib/lipgloss.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# rbs_inline: enabled
|
|
3
3
|
|
|
4
|
+
require "json"
|
|
4
5
|
require_relative "lipgloss/version"
|
|
5
6
|
|
|
6
7
|
begin
|
|
@@ -33,6 +34,11 @@ module Lipgloss
|
|
|
33
34
|
|
|
34
35
|
NO_TAB_CONVERSION = -1 #: Integer
|
|
35
36
|
|
|
37
|
+
# @rbs!
|
|
38
|
+
# type color_profile = :true_color | :ansi256 | :ansi | :ascii
|
|
39
|
+
|
|
40
|
+
COLOR_PROFILES = [:true_color, :ansi256, :ansi, :ascii].freeze #: Array[color_profile]
|
|
41
|
+
|
|
36
42
|
class << self
|
|
37
43
|
# @rbs position: Position::position_value
|
|
38
44
|
# @rbs *strings: String
|
|
@@ -73,5 +79,20 @@ module Lipgloss
|
|
|
73
79
|
def place_vertical(height, position, string)
|
|
74
80
|
_place_vertical(height, Position.resolve(position), string)
|
|
75
81
|
end
|
|
82
|
+
|
|
83
|
+
# @rbs return: color_profile
|
|
84
|
+
def color_profile
|
|
85
|
+
COLOR_PROFILES.fetch(_color_profile)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# @rbs profile: color_profile
|
|
89
|
+
# @rbs return: void
|
|
90
|
+
def color_profile=(profile)
|
|
91
|
+
index = COLOR_PROFILES.index(profile)
|
|
92
|
+
|
|
93
|
+
raise ArgumentError, "unknown color profile #{profile.inspect}, expected one of #{COLOR_PROFILES.inspect}" unless index
|
|
94
|
+
|
|
95
|
+
_set_color_profile(index)
|
|
96
|
+
end
|
|
76
97
|
end
|
|
77
98
|
end
|
data/sig/lipgloss/lipgloss.rbs
CHANGED
|
@@ -10,6 +10,9 @@ module Lipgloss
|
|
|
10
10
|
def self._place_horizontal: (Integer width, Float position, String string) -> String
|
|
11
11
|
def self._place_vertical: (Integer height, Float position, String string) -> String
|
|
12
12
|
def self.has_dark_background?: () -> bool
|
|
13
|
+
def self.has_dark_background=: (bool dark) -> bool
|
|
14
|
+
def self._color_profile: () -> Integer
|
|
15
|
+
def self._set_color_profile: (Integer profile) -> Integer
|
|
13
16
|
def self.upstream_version: () -> String
|
|
14
17
|
def self.version: () -> String
|
|
15
18
|
|
|
@@ -92,6 +95,7 @@ module Lipgloss
|
|
|
92
95
|
|
|
93
96
|
def set_string: (String string) -> Style
|
|
94
97
|
def inherit: (Style other) -> Style
|
|
98
|
+
def _to_json: () -> String
|
|
95
99
|
|
|
96
100
|
def unset_bold: () -> Style
|
|
97
101
|
def unset_italic: () -> Style
|
|
@@ -118,9 +122,9 @@ module Lipgloss
|
|
|
118
122
|
|
|
119
123
|
class Table
|
|
120
124
|
def initialize: () -> void
|
|
121
|
-
def headers: (Array[
|
|
122
|
-
def row: (Array[
|
|
123
|
-
def rows: (Array[Array[
|
|
125
|
+
def headers: (Array[_ToS] headers) -> Table
|
|
126
|
+
def row: (Array[_ToS] row) -> Table
|
|
127
|
+
def rows: (Array[Array[_ToS]] rows) -> Table
|
|
124
128
|
def border: (Symbol border_type) -> Table
|
|
125
129
|
def border_style: (Style style) -> Table
|
|
126
130
|
def border_top: (bool value) -> Table
|
data/sig/lipgloss/style.rbs
CHANGED
data/sig/lipgloss.rbs
CHANGED
|
@@ -27,6 +27,10 @@ module Lipgloss
|
|
|
27
27
|
|
|
28
28
|
NO_TAB_CONVERSION: Integer
|
|
29
29
|
|
|
30
|
+
type color_profile = :true_color | :ansi256 | :ansi | :ascii
|
|
31
|
+
|
|
32
|
+
COLOR_PROFILES: Array[color_profile]
|
|
33
|
+
|
|
30
34
|
# @rbs position: Position::position_value
|
|
31
35
|
# @rbs *strings: String
|
|
32
36
|
# @rbs return: String
|
|
@@ -56,4 +60,11 @@ module Lipgloss
|
|
|
56
60
|
# @rbs string: String
|
|
57
61
|
# @rbs return: String
|
|
58
62
|
def self.place_vertical: (Integer height, Position::position_value position, String string) -> String
|
|
63
|
+
|
|
64
|
+
# @rbs return: color_profile
|
|
65
|
+
def self.color_profile: () -> color_profile
|
|
66
|
+
|
|
67
|
+
# @rbs profile: color_profile
|
|
68
|
+
# @rbs return: void
|
|
69
|
+
def self.color_profile=: (color_profile profile) -> void
|
|
59
70
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lipgloss
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: aarch64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Roth
|
|
@@ -39,6 +39,7 @@ files:
|
|
|
39
39
|
- go/list.go
|
|
40
40
|
- go/style.go
|
|
41
41
|
- go/style_border.go
|
|
42
|
+
- go/style_hash.go
|
|
42
43
|
- go/style_spacing.go
|
|
43
44
|
- go/style_unset.go
|
|
44
45
|
- go/table.go
|