mirror of
https://gitlab.com/EternalWanderer/dice-roller.git
synced 2025-06-08 06:14:25 +02:00
Got rid of bad color implementation
This commit is contained in:
parent
4d0ab352aa
commit
3afa5fb7db
7 changed files with 78 additions and 53 deletions
16
Dice/Dice.go
16
Dice/Dice.go
|
@ -6,7 +6,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"gitlab.com/EternalWanderer/dice-roller/Colors"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -37,22 +37,20 @@ func Cast(surfaces, diceThrows, modifier int) {
|
|||
|
||||
switch {
|
||||
case modifier != 0:
|
||||
fmt.Printf("%sRolling %dd%d + %d...\n%s", Colors.ColorYellow, diceThrows, surfaces, modifier, Colors.ColorReset)
|
||||
color.Yellow("Rolling %dd%d + %d...\n", diceThrows, surfaces, modifier)
|
||||
default:
|
||||
fmt.Printf("%sRolling %dd%d...\n%s", Colors.ColorYellow, diceThrows, surfaces, Colors.ColorReset)
|
||||
color.Yellow("Rolling %dd%d...\n", diceThrows, surfaces)
|
||||
}
|
||||
|
||||
if diceThrows > 1 {
|
||||
fmt.Println(Colors.ColorMagenta, "\tIndividual rolls:",
|
||||
strings.Trim(fmt.Sprint(casts), "[]"),
|
||||
Colors.ColorReset)
|
||||
color.Magenta("\tIndividual rolls: %s", strings.Trim(fmt.Sprint(casts), "[]"))
|
||||
}
|
||||
|
||||
if modifier != 0 {
|
||||
fmt.Println("\tWithout modifier:", total)
|
||||
fmt.Println(Colors.ColorGreen, "\tWith modifier:", total+modifier, Colors.ColorReset)
|
||||
fmt.Printf("\tWithout modifier: %d\n", total)
|
||||
color.Green("\tWith modifier: %d", total+modifier)
|
||||
} else {
|
||||
fmt.Printf("%s\t%d%s\n", Colors.ColorGreen, total, Colors.ColorReset)
|
||||
color.Green("%d", total)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue