MCPcopy Create free account
hub / github.com/efogdev/mpris-timer / HexFromRGBA

Function HexFromRGBA

internal/core/prefs.go:70–76  ·  view source on GitHub ↗
(rgba *gdk.RGBA)

Source from the content-addressed store, hash-verified

68}
69
70func HexFromRGBA(rgba *gdk.RGBA) string {
71 r := int(math.Round(float64(rgba.Red()) * 255))
72 g := int(math.Round(float64(rgba.Green()) * 255))
73 b := int(math.Round(float64(rgba.Blue()) * 255))
74
75 return fmt.Sprintf("#%02X%02X%02X", r, g, b)
76}
77
78// RGBAFromHex assumes the value is correct and ignores alpha
79func RGBAFromHex(hex string) (*gdk.RGBA, error) {

Callers 2

populateVisualsGroupFunction · 0.92
RegisterAppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected