Remove colors from rich text

This commit is contained in:
Insality
2025-05-28 22:13:44 +03:00
parent 0cf5ba30db
commit 97942965cd
4 changed files with 22 additions and 30 deletions

View File

@@ -81,7 +81,7 @@ return function()
local rich_text = druid:new_rich_text(text_node)
-- Test color tag with named color
local words = rich_text:set_text("<color=red>Colored Text</color>")
local words = rich_text:set_text("<color=#FF0000>Colored Text</color>")
assert(#words > 0)
-- Word should have a tags field with color tag
@@ -104,7 +104,7 @@ return function()
local rich_text = druid:new_rich_text(text_node)
-- Test shadow tag with named color
local words = rich_text:set_text("<shadow=black>Shadowed Text</shadow>")
local words = rich_text:set_text("<shadow=#000000>Shadowed Text</shadow>")
assert(#words > 0)
assert(words[1].shadow ~= nil)
@@ -129,7 +129,7 @@ return function()
local rich_text = druid:new_rich_text(text_node)
-- Test outline tag with named color
local words = rich_text:set_text("<outline=black>Outlined Text</outline>")
local words = rich_text:set_text("<outline=#000000>Outlined Text</outline>")
assert(#words > 0)
assert(words[1].outline ~= nil)
@@ -228,7 +228,7 @@ return function()
local rich_text = druid:new_rich_text(text_node)
-- Test combined tags
local words = rich_text:set_text("<color=red><size=2>Big Red Text</size></color>")
local words = rich_text:set_text("<color=#FF0000><size=2>Big Red Text</size></color>")
assert(#words > 0)
assert(words[1].tags.color)
@@ -236,7 +236,7 @@ return function()
assert(words[1].relative_scale == 2)
-- Test nested tags
words = rich_text:set_text("<color=red>Red <size=2>Big Red</size> Red</color>")
words = rich_text:set_text("<color=#FF0000>Red <size=2>Big Red</size> Red</color>")
assert(#words >= 3)
-- All words should have color tag