From 9adf6de4b5f3df44657d336ed49f9b992d50f458 Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Wed, 10 Apr 2019 21:50:03 +0200 Subject: graphql: expose label color --- graphql/resolvers/label.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 graphql/resolvers/label.go (limited to 'graphql/resolvers/label.go') diff --git a/graphql/resolvers/label.go b/graphql/resolvers/label.go new file mode 100644 index 00000000..7619f748 --- /dev/null +++ b/graphql/resolvers/label.go @@ -0,0 +1,22 @@ +package resolvers + +import ( + "context" + "image/color" + + "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/graphql/graph" +) + +var _ graph.LabelResolver = &labelResolver{} + +type labelResolver struct{} + +func (labelResolver) Name(ctx context.Context, obj *bug.Label) (string, error) { + return obj.String(), nil +} + +func (labelResolver) Color(ctx context.Context, obj *bug.Label) (*color.RGBA, error) { + rgba := obj.RGBA() + return &rgba, nil +} -- cgit