From 1c99ca52cb02c16be4be2537077d2cdaa76045cf Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 11 Jul 2020 15:00:35 +0800 Subject: [PATCH] add color.go --- types/color.go | 22 ---------------------- types/side.go | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 types/side.go diff --git a/types/color.go b/types/color.go index 63ccd71d6..b0df8c892 100644 --- a/types/color.go +++ b/types/color.go @@ -3,25 +3,3 @@ package types const Green = "#228B22" const Red = "#800000" -// SideType define side type of order -type SideType string - -const ( - SideTypeBuy = SideType("BUY") - SideTypeSell = SideType("SELL") -) - -func (side SideType) Color() string { - if side == SideTypeBuy { - return Green - } - if side == SideTypeSell { - return Red - } - - return "#f0f0f0" -} - -func SideToColorName(side SideType) string { - return side.Color() -} diff --git a/types/side.go b/types/side.go new file mode 100644 index 000000000..7fd24785b --- /dev/null +++ b/types/side.go @@ -0,0 +1,24 @@ +package types + +// SideType define side type of order +type SideType string + +const ( + SideTypeBuy = SideType("BUY") + SideTypeSell = SideType("SELL") +) + +func (side SideType) Color() string { + if side == SideTypeBuy { + return Green + } + if side == SideTypeSell { + return Red + } + + return "#f0f0f0" +} + +func SideToColorName(side SideType) string { + return side.Color() +}