Method: Nuklear::UI::Container#ui_color_picker

Defined in:
ext/nuklear/nkrb_ui_color_picker.c

#ui_color_picker(rcontext, rcolor, rtype) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'ext/nuklear/nkrb_ui_color_picker.c', line 3

VALUE nkrb_ui_color_picker(VALUE self, VALUE rcontext, VALUE rcolor, VALUE rtype) {
  struct nk_context *ctx = nkrb_context_get(rcontext);
  enum nk_color_format type = (SYM2ID(rtype) == rb_intern("rgb")) ? NK_RGB : NK_RGBA;
  struct nk_style_item *style = nkrb_style_item(rcolor);
  struct nk_color color;
  ASSIGN_STYLE_AS_COLOR(color, style);

  if (nk_color_pick(ctx, &color, type)) {
    style->data.color = color;
    return rcolor;
  }

  return Qnil;
}