aboutsummaryrefslogtreecommitdiff
path: root/lua/colorizer.lua
diff options
context:
space:
mode:
authorAkianonymus <anonymus.aki@gmail.com>2022-08-27 20:31:45 +0530
committerAkianonymus <anonymus.aki@gmail.com>2022-08-27 20:31:45 +0530
commite0b0e0cf1e11195063b305e505fd50a0a02efb29 (patch)
treea114dbb0cbb0673dbcaf1681b92300f2636ba75b /lua/colorizer.lua
parentMerge pull request #8 from Akianonymus/master (diff)
fix: error when invalid hsl/rgb values
more like a type fix
Diffstat (limited to 'lua/colorizer.lua')
-rw-r--r--lua/colorizer.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua
index e14db85..6ecf8d1 100644
--- a/lua/colorizer.lua
+++ b/lua/colorizer.lua
@@ -339,7 +339,7 @@ do
end
local h, s, l, match_end = line:sub(i):match "^hsl%(%s*(%d+)%s*,%s*(%d+)%%%s*,%s*(%d+)%%%s*%)()"
if not match_end then
- local h, s, l, match_end = line:sub(i):match "^hsl%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s*%)()"
+ h, s, l, match_end = line:sub(i):match "^hsl%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s*%)()"
if not match_end then
return
end
@@ -371,7 +371,7 @@ do
local r, g, b, a, match_end =
line:sub(i):match "^rgba%(%s*(%d+%%?)%s*,%s*(%d+%%?)%s*,%s*(%d+%%?)%s*,%s*([.%d]+)%s*%)()"
if not match_end then
- local r, g, b, a, match_end = line:sub(i):match "^rgba%(%s*(%d+%%?)%s+(%d+%%?)%s+(%d+%%?)%s+([.%d]+)%s*%)()"
+ r, g, b, a, match_end = line:sub(i):match "^rgba%(%s*(%d+%%?)%s+(%d+%%?)%s+(%d+%%?)%s+([.%d]+)%s*%)()"
if not match_end then
return
end
@@ -402,7 +402,7 @@ do
end
local h, s, l, a, match_end = line:sub(i):match "^hsla%(%s*(%d+)%s*,%s*(%d+)%%%s*,%s*(%d+)%%%s*,%s*([.%d]+)%s*%)()"
if not match_end then
- local h, s, l, a, match_end = line:sub(i):match "^hsla%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s+([.%d]+)%s*%)()"
+ h, s, l, a, match_end = line:sub(i):match "^hsla%(%s*(%d+)%s+(%d+)%%%s+(%d+)%%%s+([.%d]+)%s*%)()"
if not match_end then
return
end
@@ -431,6 +431,7 @@ do
return match_end - 1, rgb_hex
end
end
+
local css_function_parser, rgb_function_parser, hsl_function_parser
do
local CSS_FUNCTION_TRIE = Trie { "rgb", "rgba", "hsl", "hsla" }