Initial scaffold: project structure, .gitignore, go.mod
This commit is contained in:
30
internal/icons/states.go
Normal file
30
internal/icons/states.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package icons
|
||||
|
||||
import "image/color"
|
||||
|
||||
// State represents the current sync state for icon rendering.
|
||||
type State int
|
||||
|
||||
const (
|
||||
StateIdle State = iota // Green — all folders idle
|
||||
StateSyncing // Blue — syncing/scanning
|
||||
StatePaused // Gray — all paused
|
||||
StateError // Red — folder error
|
||||
StateDisconnected // Dark gray — cannot reach Syncthing
|
||||
)
|
||||
|
||||
// colors maps each state to its icon color.
|
||||
var colors = map[State]color.RGBA{
|
||||
StateIdle: {76, 175, 80, 255}, // green
|
||||
StateSyncing: {33, 150, 243, 255}, // blue
|
||||
StatePaused: {158, 158, 158, 255}, // gray
|
||||
StateError: {244, 67, 54, 255}, // red
|
||||
StateDisconnected: {97, 97, 97, 255}, // dark gray
|
||||
}
|
||||
|
||||
func colorForState(s State) color.RGBA {
|
||||
if c, ok := colors[s]; ok {
|
||||
return c
|
||||
}
|
||||
return colors[StateDisconnected]
|
||||
}
|
||||
Reference in New Issue
Block a user