@@ -457,6 +457,16 @@ Updated:
457
457
the ` write! ` macro to write to a pre-existing buffer.
458
458
459
459
Added:
460
+ - New ` tui_color! ` decl macro that allows all the delightful color palette used in
461
+ ` giti ` to be available to anyone using this crate! ` r3bl_ansi_color ` is updated as
462
+ well to work with this macro. ` AnsiStyledText ` has constructor function ` fg_rgb_color() `
463
+ and method ` AnsiStyledText::bg_rgb_color() ` that when combined make it very easy to use the
464
+ ` tui_color! ` macro to create fun colors and then use them in the ` AnsiStyledText `
465
+ struct (via these new easy to use functions). This is very common when colorizing
466
+ terminal output for log formatting or a welcome message. You can see this in the demo
467
+ example for ` r3bl_tui ` which uses this
468
+ ` let msg_fmt = fg_rgb_color(ASTColor::from(tui_color!(lizard_green)), &msg); ` . Also ` r3bl_ansi_color `
469
+ has an equivalent macro to this called ` rgb_color! ` .
460
470
- Add new target in ` run ` Nushell script called ` nu run release-examples-no-log ` to run
461
471
the examples without logging. This is useful for performance testing. Now that HUD is
462
472
displayed in the examples, there is no need to enable logging just to see this
@@ -884,7 +894,7 @@ idioms and design patterns are used in this release.
884
894
transform other types into these types.
885
895
- The ` graphemes ` module containing ` UnicodeString ` handling have been totally rewritten.
886
896
They are now no allocation structures! In all past versions, the ` UnicodeString ` was a
887
- ` String ` under the hood. Now it is a ` StringStorage ` which is a ` smallstr ` that
897
+ ` String ` under the hood. Now it is a ` InlineString ` which is a ` smallstr ` that
888
898
initially allocates on the stack, and it can spill over into the heap if it needs to.
889
899
The struct is now named ` GCString ` . The "newtype" design pattern / idiom and
890
900
` arg: impl Into<T> ` in ` GCString ` and other specific types are used, such as ` SegIndex ` ,
@@ -945,7 +955,7 @@ Changed:
945
955
- The ` graphemes ` module containing ` UnicodeString ` handling have been totally
946
956
rewritten. They are now optimized for memory latency (access, mutation, and
947
957
allocation). For performance reasons they are not "no allocation" structures.
948
- ` GCString ` now owns a ` StringStorage ` under the hood. The
958
+ ` GCString ` now owns a ` InlineString ` under the hood. The
949
959
` UnicodeStringSegment ` , now called ` Seg ` , does not own anything (no heap or string
950
960
allocation, and is a very "scalarized" struct), and needs a ` GCString ` to be
951
961
able to do anything. All the existing code that relies on this has been rewritten to
@@ -974,6 +984,10 @@ Changed:
974
984
- Replace the use of ` bool ` with meaningful enums to enhance code readability.
975
985
976
986
- Added:
987
+ - Move ` term.rs ` from ` r3bl_ansi_color ` to ` r3bl_core ` crate. This is where the functions
988
+ to get the terminal window size and width belong, and whether the terminal is
989
+ interactive or not. Terminal color detection capabilities and low level color output
990
+ manipulation are still in ` r3bl_ansi_color ` .
977
991
- [ Archive] ( #archived-2025-03-11 ) the ` tui_style! ` proc macro. Replace it with an easier
978
992
to use decl macro ` new_style! ` . This allows the ` r3bl_macro ` crate to be removed from
979
993
the workspace, and all the crates in it. ` new_style! ` makes it a breeze to work with
@@ -990,10 +1004,13 @@ Changed:
990
1004
- [ PR 1] ( https://github.com/r3bl-org/r3bl-open-core/pull/372 )
991
1005
- [ PR 2] ( https://github.com/r3bl-org/r3bl-open-core/pull/373 )
992
1006
- New hashmap which remembers insertion order called ` OrderedMap ` .
993
- - New module ` stack_alloc_types ` that contain data structures that are allocated on the stack.
994
- If they grow too big, they are then moved to the heap. Under the covers, the ` small_vec ` and
995
- ` small_str ` crates are used. Lots of macros are provided to make it easy to work with these
996
- data structures. And to make it easy to write into them without allocating them.
1007
+ - New module ` stack_alloc_types ` that contain data structures that are allocated on the
1008
+ stack. If they grow too big, they are then moved to the heap. Under the covers, the
1009
+ ` small_vec ` and ` small_str ` crates are used. Lots of macros are provided to make it
1010
+ easy to work with these data structures (eg: ` inline_string! ` , ` tiny_inline_string! ` ).
1011
+ And to make it easy to write into them without allocating them. Please note that if
1012
+ you make the ` r3bl_ansi_color::sizing::DEFAULT_STRING_STORAGE_SIZE ` number too large,
1013
+ eg: more than ` 16 ` , then it will slow down the TUI editor performance use.
997
1014
- ` Percent ` struct now has a ` as_glyph() ` method which displays the percentage as a
998
1015
Unicode glyph ranging from ` STATS_25P_GLYPH ` to ` STATS_50P_GLYPH ` to ` STATS_75P_GLYPH `
999
1016
to ` STATS_100P_GLYPH ` depending on its value.
@@ -1473,17 +1490,41 @@ This is the first release of this crate.
1473
1490
### v_next_release_r3bl_ansi_color
1474
1491
1475
1492
This is a minor change that adds ` vscode ` to the list of environment variables that mean
1476
- that ` truecolor ` is supported.
1493
+ that ` truecolor ` is supported. It removes duplication of ` term.rs ` in the ` r3bl-open-core `
1494
+ repo and workspace. The names are also cleaned up so there's no confusion about using
1495
+ ` Color ` or ` Style ` which are so generic and used in many other crates.
1477
1496
1478
1497
- Updated:
1479
1498
- Use the latest Rust 2024 edition.
1480
1499
1481
1500
- Added:
1482
- - Support for ` $TERM_PROGRAM ` = ` vscode ` to the list of environment variables that mean
1483
- that ` truecolor ` is supported. This is in ` check_ansi_color.rs ` file.
1484
- - Lots of new helper functions to make it easy to colorize ` &str ` like ` red("hello") ` ,
1485
- ` green("world") ` , etc. This removes the requirement to depend on ` crossterm::Stylize `
1486
- for colorizing strings that are intended to be displayed in console stdout / stderr.
1501
+ - Support for inline (stack allocated) data structures (` InlineVecASTStyles ` and
1502
+ ` AnsiStyledText::to_small_str() ` ). Please note that if you make the
1503
+ ` r3bl_ansi_color::sizing::DEFAULT_STRING_STORAGE_SIZE ` number too large, eg: more than
1504
+ ` 16 ` , then it will slow down the TUI editor performance use.
1505
+ - Lots of new easy constructor functions to make it easy to colorize ` &str ` like
1506
+ ` red("hello") ` , ` green("world") ` , etc. This removes the requirement to depend on
1507
+ ` crossterm::Stylize ` for colorizing strings that are intended to be displayed in
1508
+ console stdout / stderr. Methods are provided to add background colors as well
1509
+ ` AnsiStyledText::bg_dark_grey() ` .
1510
+ - Easy constructor functions are provided ` fg_rgb_color() ` and
1511
+ ` AnsiStyledText::bg_rgb_color() ` . Together they allow easy integration with
1512
+ ` tui_color! ` and make it trivial to write code that uses styles / colors from the
1513
+ ` r3bl_tui ` crate and apply them to ` AnsiStyledText ` which is a very common pattern
1514
+ when colorizing log output.
1515
+ - Easy macro ` rgb_color! ` to create lots of beautiful colors with ease. This is similar
1516
+ to ` r3bl_tui ` crate's ` tui_color! ` macro.
1517
+
1518
+ - Removed:
1519
+ - ` term.rs ` is now in ` r3bl_core ` . Support for ` $TERM_PROGRAM ` = ` vscode ` to the list of
1520
+ environment variables that mean that ` truecolor ` is supported. This is in
1521
+ ` check_ansi_color.rs ` file.
1522
+
1523
+ - Changed:
1524
+ - ` Color ` is now ` ASTColor ` .
1525
+ - ` Style ` is now ` ASTStyle ` .
1526
+ - Proper converters ` From ` implementations are provided to convert between ` ASTColor `
1527
+ and ` RGBColor ` , and ` Ansi256Color ` .
1487
1528
1488
1529
### v0.7.0 (2024-10-18)
1489
1530
0 commit comments