diff --git a/README.md b/README.md index 542ba1e..d779727 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Alternatively, if you're on Arch Linux you can install the `gotop` package from ## Colorschemes A different Colorscheme can be set with the `-c` flag followed its name. You can find them in the `colorschemes` folder. -Feel free to add a new one. You can use 256 colors, bold, underline, and reverse. More info [here](https://godoc.org/github.com/nsf/termbox-go#Attribute) and [here](https://godoc.org/github.com/nsf/termbox-go#OutputMode) under 'Output256'. +Feel free to add a new one. You can use 256 colors, bold, underline, and reverse. You can see the template and get more info [here]() and see the default colorscheme as an example [here](). ## TODO diff --git a/colorschemes/default.go b/colorschemes/default.go new file mode 100644 index 0000000..985b0a4 --- /dev/null +++ b/colorschemes/default.go @@ -0,0 +1,30 @@ +package colorschemes + +var DefaultCS = Colorscheme{ + Name: "Default", + Author: "Caleb Bassi", + + Bg: -1, + + Border{ + Labels: 0, + Line: 0, + }, + + CPU{ + Lines: []int{0, 0, 0, 0}, + }, + + Mem{ + Main: 0, + Swap: 0, + }, + + Proc{ + Cursor: 5, + }, + + Sparkline{ + Graph: 10, + }, +} diff --git a/colorschemes/solarized.go b/colorschemes/solarized.go new file mode 100644 index 0000000..e69de29 diff --git a/colorschemes/solarized.png b/colorschemes/solarized.png new file mode 100644 index 0000000..e69de29 diff --git a/colorschemes/template.go b/colorschemes/template.go new file mode 100644 index 0000000..5819f74 --- /dev/null +++ b/colorschemes/template.go @@ -0,0 +1,46 @@ +package colorschemes + +/* + the standard 256 terminal colors are supported + + -1 = clear + + You can combine a color with Bold, Underline, or Reverse by using bitwise OR ('|'). + For example, to get Bold red Labels, you would do 'Labels: 2 | Bold' +*/ + +// Ignore this +const ( + Bold int = 1 << (iota + 9) + Underline + Reverse +) + +type Colorscheme struct { + Name string + Author string + + Bg int + + Border struct { + Labels int + Line int + } + + CPU struct { + Lines []int + } + + Mem struct { + Main int + Swap int + } + + Proc struct { + Cursor int + } + + Sparkline struct { + Graph int + } +} diff --git a/termui/theme.go b/termui/theme.go index fd1854f..d8ea0c2 100644 --- a/termui/theme.go +++ b/termui/theme.go @@ -30,19 +30,3 @@ type ColorScheme struct { LineGraph Attribute TableCursor Attribute } - -// 0 <= r,g,b <= 5 -func ColorRGB(r, g, b int) Attribute { - within := func(n int) int { - if n < 0 { - return 0 - } - if n > 5 { - return 5 - } - return n - } - - r, b, g = within(r), within(b), within(g) - return Attribute(0x0f + 36*r + 6*g + b) -}