mirror of
https://github.com/alecthomas/chroma.git
synced 2026-05-22 10:15:46 +02:00
Generalise and support 8, 256 and 16m colour terminals.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package styles
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestColourRGB(t *testing.T) {
|
||||
colour := ParseColour("#8913af")
|
||||
require.Equal(t, uint8(0x89), colour.Red())
|
||||
require.Equal(t, uint8(0x13), colour.Green())
|
||||
require.Equal(t, uint8(0xaf), colour.Blue())
|
||||
}
|
||||
|
||||
func TestColourString(t *testing.T) {
|
||||
require.Equal(t, "#8913af", ParseColour("#8913af").String())
|
||||
}
|
||||
Reference in New Issue
Block a user