From c1828f27b82cd057803f65053bc4047f0a8f4ab7 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 12 Dec 2024 10:59:21 +0300 Subject: [PATCH 1/4] Dependencies update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 557ed7a0..efa7f561 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/essentialkaos/check v1.4.1 github.com/essentialkaos/depsy v1.3.1 github.com/essentialkaos/go-linenoise/v3 v3.6.1 - golang.org/x/crypto v0.30.0 + golang.org/x/crypto v0.31.0 golang.org/x/sys v0.28.0 ) diff --git a/go.sum b/go.sum index b5f6a78d..f68808f7 100644 --- a/go.sum +++ b/go.sum @@ -13,7 +13,7 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= -golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= -golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 4659476c62c1a14bc6b9f4d0e00e2b6880ff337a Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sat, 14 Dec 2024 02:12:21 +0300 Subject: [PATCH 2/4] Update card --- .github/images/card.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/images/card.svg b/.github/images/card.svg index c7de220a..543521c8 100644 --- a/.github/images/card.svg +++ b/.github/images/card.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From a503099d58bbc11829aedadb42ed71bcff637eb2 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sun, 15 Dec 2024 01:06:56 +0300 Subject: [PATCH 3/4] Update card --- .github/images/card.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/images/card.svg b/.github/images/card.svg index 543521c8..549210a3 100644 --- a/.github/images/card.svg +++ b/.github/images/card.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From 741ae6cd54665da9d385d3e2cf9a0856e4b256be Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 16 Dec 2024 14:46:41 +0300 Subject: [PATCH 4/4] [color] Improve named colors support --- CHANGELOG.md | 6 +++++- color/color.go | 9 +++++---- color/color_test.go | 2 +- version.go | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8302ca0..20756998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## Changelog -### [13.15.0](https://kaos.sh/ek/13.15.1) +### [13.15.2](https://kaos.sh/ek/13.15.2) + +- `[color]` Improved named colors support + +### [13.15.1](https://kaos.sh/ek/13.15.1) - `[options]` Added method `Argument.Uint64` - `[options]` Return type of method `Argument.Uint` set from `uint64` to `uint` diff --git a/color/color.go b/color/color.go index 26e7f4d4..8555aacc 100644 --- a/color/color.go +++ b/color/color.go @@ -12,6 +12,7 @@ import ( "fmt" "math" "strconv" + "strings" "github.com/essentialkaos/ek/v13/mathutil" ) @@ -59,8 +60,8 @@ type HSL struct { // ////////////////////////////////////////////////////////////////////////////////// // -// colors is colors keywords -var colors = map[string]uint32{ +// named is a map of named colors +var named = map[string]uint32{ "aliceblue": 0xf0f8ff, "antiquewhite": 0xfaebd7, "aqua": 0x00ffff, @@ -416,8 +417,8 @@ func (c HSL) GoString() string { // Parse parses color func Parse(c string) (Hex, error) { - if colors[c] != 0 { - return Hex{v: colors[c]}, nil + if named[strings.ToLower(c)] != 0 { + return Hex{v: named[strings.ToLower(c)]}, nil } if c != "" && c[0] == '#' { diff --git a/color/color_test.go b/color/color_test.go index 7addb8c5..529d88d1 100644 --- a/color/color_test.go +++ b/color/color_test.go @@ -28,7 +28,7 @@ var _ = Suite(&ColorSuite{}) // ////////////////////////////////////////////////////////////////////////////////// // func (s *ColorSuite) TestParse(c *C) { - color, err := Parse("violet") + color, err := Parse("vIOlEt") c.Assert(err, IsNil) c.Assert(color.v, Equals, uint32(0xEE82EE)) diff --git a/version.go b/version.go index bba105b8..8636aee9 100644 --- a/version.go +++ b/version.go @@ -8,4 +8,4 @@ package ek // ////////////////////////////////////////////////////////////////////////////////// // // VERSION is current ek package version -const VERSION = "13.15.1" +const VERSION = "13.15.2"