Skip to content

Commit

Permalink
pybricks/parameters: add brick colors
Browse files Browse the repository at this point in the history
These are some standard brick colors measured using the
ColorDistance sensor
  • Loading branch information
Novakasa authored and laurensvalk committed Jul 4, 2023
1 parent 920bd47 commit 338cefa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pybricks/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ extern const pb_type_Color_obj_t pb_Color_NONE_obj;
extern const pb_type_Color_obj_t pb_Color_BLACK_obj;
extern const pb_type_Color_obj_t pb_Color_GRAY_obj;
extern const pb_type_Color_obj_t pb_Color_WHITE_obj;
extern const pb_type_Color_obj_t pb_Color_BRICK_YELLOW_obj;
extern const pb_type_Color_obj_t pb_Color_BRICK_GREEN_obj;
extern const pb_type_Color_obj_t pb_Color_BRICK_RED_obj;
extern const pb_type_Color_obj_t pb_Color_BRICK_BLACK_obj;
extern const pb_type_Color_obj_t pb_Color_BRICK_WHITE_obj;
extern const pb_type_Color_obj_t pb_Color_BRICK_BLUE_obj;

extern const mp_obj_type_t pb_enum_type_Direction;

Expand Down
30 changes: 30 additions & 0 deletions pybricks/parameters/pb_type_color.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,36 @@ const pb_type_Color_obj_t pb_Color_WHITE_obj = {
.hsv = {0, 0, 100}
};

const pb_type_Color_obj_t pb_Color_BRICK_YELLOW_obj = {
{&pb_type_Color},
.hsv = {52, 96, 90}
};

const pb_type_Color_obj_t pb_Color_BRICK_GREEN_obj = {
{&pb_type_Color},
.hsv = {140, 89, 48}
};

const pb_type_Color_obj_t pb_Color_BRICK_RED_obj = {
{&pb_type_Color},
.hsv = {357, 96, 71}
};

const pb_type_Color_obj_t pb_Color_BRICK_BLACK_obj = {
{&pb_type_Color},
.hsv = {189, 49, 17}
};

const pb_type_Color_obj_t pb_Color_BRICK_WHITE_obj = {
{&pb_type_Color},
.hsv = {0, 5, 95}
};

const pb_type_Color_obj_t pb_Color_BRICK_BLUE_obj = {
{&pb_type_Color},
.hsv = {221, 96, 67}
};

/**
* Gets the pointer to the hsv type from a Color type.
*
Expand Down

0 comments on commit 338cefa

Please sign in to comment.