mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-20 20:22:10 +00:00
Code to dump basic colors from a theme as escape codes
This commit is contained in:
parent
c1791c8d2b
commit
c877b2a5cb
4 changed files with 118 additions and 13 deletions
|
|
@ -57,6 +57,10 @@ type RGBA struct {
|
|||
Red, Green, Blue, Inverse_alpha uint8
|
||||
}
|
||||
|
||||
func (self RGBA) AsRGBSharp() string {
|
||||
return fmt.Sprintf("#%02x%02x%02x", self.Red, self.Green, self.Blue)
|
||||
}
|
||||
|
||||
func (self *RGBA) parse_rgb_strings(r string, g string, b string) bool {
|
||||
var rv, gv, bv uint64
|
||||
var err error
|
||||
|
|
@ -77,6 +81,12 @@ func (self *RGBA) AsRGB() uint32 {
|
|||
return uint32(self.Blue) | (uint32(self.Green) << 8) | (uint32(self.Red) << 16)
|
||||
}
|
||||
|
||||
func (self *RGBA) FromRGB(col uint32) {
|
||||
self.Red = uint8((col >> 16) & 0xff)
|
||||
self.Green = uint8((col >> 8) & 0xff)
|
||||
self.Blue = uint8((col) & 0xff)
|
||||
}
|
||||
|
||||
type color_type struct {
|
||||
is_numbered bool
|
||||
val RGBA
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue