@@ -122,7 +122,7 @@ pub mut:
122122}
123123
124124// hex takes in a 32 bit integer and splits it into 4 byte values
125- pub fn hex (color int ) Color {
125+ pub fn hex (color i 32 ) Color {
126126 return Color{
127127 r: u8 ((color >> 16 ) & 0xFF )
128128 g: u8 ((color >> 8 ) & 0xFF )
@@ -151,10 +151,10 @@ pub fn rgba(r u8, g u8, b u8, a u8) Color {
151151
152152// + adds `b` to `a`, with a maximum value of 255 for each channel
153153pub fn (a Color) + (b Color) Color {
154- mut na := int (a.a) + b.a
155- mut nr := int (a.r) + b.r
156- mut ng := int (a.g) + b.g
157- mut nb := int (a.b) + b.b
154+ mut na := i32 (a.a) + b.a
155+ mut nr := i32 (a.r) + b.r
156+ mut ng := i32 (a.g) + b.g
157+ mut nb := i32 (a.b) + b.b
158158 if na > 255 {
159159 na = 255
160160 }
@@ -178,9 +178,9 @@ pub fn (a Color) + (b Color) Color {
178178// - subtracts `b` from `a`, with a minimum value of 0 for each channel
179179pub fn (a Color) - (b Color) Color {
180180 mut na := if a.a > b.a { a.a } else { b.a }
181- mut nr := int (a.r) - b.r
182- mut ng := int (a.g) - b.g
183- mut nb := int (a.b) - b.b
181+ mut nr := i32 (a.r) - b.r
182+ mut ng := i32 (a.g) - b.g
183+ mut nb := i32 (a.b) - b.b
184184 if na < 0 {
185185 na = 0
186186 }
@@ -249,25 +249,25 @@ pub fn (c Color) str() string {
249249 return 'Color{${c .r }, ${c .g }, ${c .b }, ${c .a }}'
250250}
251251
252- // rgba8 converts a color value to an int in the RGBA8 order.
252+ // rgba8 converts a color value to an 32bit int in the RGBA8 order.
253253// see https://developer.apple.com/documentation/coreimage/ciformat
254254@[inline]
255- pub fn (c Color) rgba8 () int {
256- return int (u32 (c.r) << 24 | u32 (c.g) << 16 | u32 (c.b) << 8 | u32 (c.a))
255+ pub fn (c Color) rgba8 () i 32 {
256+ return i32 (u32 (c.r) << 24 | u32 (c.g) << 16 | u32 (c.b) << 8 | u32 (c.a))
257257}
258258
259- // bgra8 converts a color value to an int in the BGRA8 order.
259+ // bgra8 converts a color value to an 32bit int in the BGRA8 order.
260260// see https://developer.apple.com/documentation/coreimage/ciformat
261261@[inline]
262- pub fn (c Color) bgra8 () int {
263- return int (u32 (c.b) << 24 | u32 (c.g) << 16 | u32 (c.r) << 8 | u32 (c.a))
262+ pub fn (c Color) bgra8 () i 32 {
263+ return i32 (u32 (c.b) << 24 | u32 (c.g) << 16 | u32 (c.r) << 8 | u32 (c.a))
264264}
265265
266- // abgr8 converts a color value to an int in the ABGR8 order.
266+ // abgr8 converts a color value to an 32bit int in the ABGR8 order.
267267// see https://developer.apple.com/documentation/coreimage/ciformat
268268@[inline]
269- pub fn (c Color) abgr8 () int {
270- return int (u32 (c.a) << 24 | u32 (c.b) << 16 | u32 (c.g) << 8 | u32 (c.r))
269+ pub fn (c Color) abgr8 () i 32 {
270+ return i32 (u32 (c.a) << 24 | u32 (c.b) << 16 | u32 (c.g) << 8 | u32 (c.r))
271271}
272272
273273const string_colors = {
@@ -298,7 +298,7 @@ const string_colors = {
298298pub fn color_from_string (s string ) Color {
299299 if s.starts_with ('#' ) {
300300 mut hex_str := '0x' + s[1 ..]
301- return hex (hex_str.int ())
301+ return hex (hex_str.i32 ())
302302 } else {
303303 return string_colors[s]
304304 }
0 commit comments