| 1 | import strconv |
| 2 | |
| 3 | fn color_code_to_rgb(color string) []int { |
| 4 | clr := color.replace('#', '') |
| 5 | return [int(strconv.parse_int(clr[0..2], 16, 0) or { return [0, 0, 0] }), |
| 6 | int(strconv.parse_int(clr[2..4], 16, 0) or { return [0, 0, 0] }), |
| 7 | int(strconv.parse_int(clr[4..6], |
| 8 | 16, 0) or { return [0, 0, 0] })] |
| 9 | } |
| 10 | |
| 11 | fn main() { |
| 12 | dump(color_code_to_rgb('#abcdef')) |
| 13 | } |
| 14 |