-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Delete `mpd` directory. - Allow updating multiple items from the same "data source", e.g. for displaying time in two different formats without having to read the time twice. I'm still not satisfied with how the code looks, and I want to think of better names for some types, but this works for now.
- Loading branch information
Showing
10 changed files
with
292 additions
and
264 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
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 dsts | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var ErrInvalidColor = errors.New("invalid color") | ||
|
||
const ( | ||
DefaultStatusColor = "#999999" | ||
DefaultStatusColorError = "#e20024" | ||
) | ||
|
||
func isNumber(c rune) bool { | ||
return c >= '0' && c <= '9' | ||
} | ||
|
||
func IsValidColor(color string) bool { | ||
if len(color) != len("#000") && len(color) != len("#000000") { | ||
return false | ||
} | ||
if color[0] != '#' { | ||
return false | ||
} | ||
|
||
for i, c := range color { | ||
if i == 0 { | ||
continue | ||
} | ||
if !isNumber(c) { | ||
return false | ||
} | ||
} | ||
|
||
return true | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.