-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package commands | ||
|
||
import ( | ||
"runtime" | ||
|
||
"github.com/zeppelinmc/zeppelin/protocol/text" | ||
"github.com/zeppelinmc/zeppelin/server/command" | ||
) | ||
|
||
var gc = command.Command{ | ||
Node: command.NewLiteral("gc"), | ||
Namespace: "zeppelin", | ||
Callback: func(ccc command.CommandCallContext) { | ||
runtime.GC() | ||
|
||
ccc.Executor.SystemMessage(text.Text("Done.").WithColor(text.BrightGreen)) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package text | ||
|
||
func New() TextComponent { | ||
return TextComponent{} | ||
} | ||
|
||
func (t TextComponent) WithColor(c string) TextComponent { | ||
t.Color = c | ||
return t | ||
} | ||
|
||
func (t TextComponent) WithText(c string) TextComponent { | ||
t.Text = c | ||
return t | ||
} | ||
|
||
func (t TextComponent) WithItalic() TextComponent { | ||
t.Italic = !t.Italic | ||
return t | ||
} | ||
|
||
func (t TextComponent) WithUnderline() TextComponent { | ||
t.Underlined = !t.Underlined | ||
return t | ||
} | ||
|
||
func (t TextComponent) WithStrikethrough() TextComponent { | ||
t.Strikethrough = !t.Strikethrough | ||
return t | ||
} | ||
|
||
func (t TextComponent) WithObfuscation() TextComponent { | ||
t.Obfuscated = !t.Obfuscated | ||
return t | ||
} | ||
|
||
func Color(c string) TextComponent { | ||
return TextComponent{Color: c} | ||
} | ||
|
||
func Text(c string) TextComponent { | ||
return TextComponent{Text: c} | ||
} | ||
|
||
func Italic() TextComponent { | ||
return TextComponent{Italic: true} | ||
} | ||
|
||
func Underline() TextComponent { | ||
return TextComponent{Underlined: true} | ||
} | ||
|
||
func Strikethrough() TextComponent { | ||
return TextComponent{Strikethrough: true} | ||
} | ||
|
||
func Obfuscation() TextComponent { | ||
return TextComponent{Obfuscated: true} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package text | ||
|
||
import ( | ||
"fmt" | ||
"image/color" | ||
) | ||
|
||
// colors | ||
const ( | ||
Black = "black" | ||
DarkBlue = "dark_blue" | ||
DarkGreen = "dark_green" | ||
DarkCyan = "dark_aqua" | ||
DarkRed = "dark_red" | ||
Purple = "dark_purple" | ||
Gold = "gold" | ||
Gray = "gray" | ||
DarkGray = "dark_gray" | ||
Blue = "blue" | ||
BrightGreen = "green" | ||
Cyan = "aqua" | ||
Red = "red" | ||
Pink = "light_purple" | ||
Yellow = "yellow" | ||
White = "white" | ||
) | ||
|
||
func RGB(r, g, b uint8) string { | ||
return fmt.Sprintf("#%02X%02X%02X", r, g, b) | ||
} | ||
|
||
func CustomColor(c color.Color) string { | ||
r, g, b, _ := c.RGBA() | ||
|
||
return RGB(uint8(r>>8), uint8(g>>8), uint8(b>>8)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters