2019-04-10 22:50:03 +03:00
|
|
|
package resolvers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"image/color"
|
|
|
|
|
|
|
|
"github.com/MichaelMure/git-bug/graphql/graph"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ graph.ColorResolver = &colorResolver{}
|
|
|
|
|
|
|
|
type colorResolver struct{}
|
|
|
|
|
2020-02-03 23:03:48 +03:00
|
|
|
func (colorResolver) R(_ context.Context, obj *color.RGBA) (int, error) {
|
2019-04-10 22:50:03 +03:00
|
|
|
return int(obj.R), nil
|
|
|
|
}
|
|
|
|
|
2020-02-03 23:03:48 +03:00
|
|
|
func (colorResolver) G(_ context.Context, obj *color.RGBA) (int, error) {
|
2019-04-10 22:50:03 +03:00
|
|
|
return int(obj.G), nil
|
|
|
|
}
|
|
|
|
|
2020-02-03 23:03:48 +03:00
|
|
|
func (colorResolver) B(_ context.Context, obj *color.RGBA) (int, error) {
|
2019-04-10 22:50:03 +03:00
|
|
|
return int(obj.B), nil
|
|
|
|
}
|