// Test creation and conversion functions. // Ref: false --- // Compare both ways. #test(rgb(0%, 30%, 70%), rgb("004db3")) // Alpha channel. #test(rgb(255, 0, 0, 50%), rgb("ff000080")) // Test color modification methods. #test(rgb(25, 35, 45).lighten(10%), rgb(48, 57, 66)) #test(rgb(40, 30, 20).darken(10%), rgb(36, 27, 18)) #test(rgb("#133337").negate(), rgb(236, 204, 200)) #test(white.lighten(100%), white) --- // Test gray color conversion. // Ref: true #stack(dir: ltr, rect(fill: luma(0)), rect(fill: luma(80%))) --- // Error for values that are out of range. // Error: 11-14 must be between 0 and 255 #test(rgb(-30, 15, 50)) --- // Error: 6-11 string contains non-hexadecimal letters #rgb("lol") --- // Error: 5-7 missing argument: red component #rgb() --- // Error: 5-11 missing argument: blue component #rgb(0, 1) --- // Error: 21-26 expected integer or ratio, found boolean #rgb(10%, 20%, 30%, false) --- // Ref: true #let envelope = symbol( "🖂", ("stamped", "🖃"), ("stamped.pen", "🖆"), ("lightning", "🖄"), ("fly", "🖅"), ) #envelope #envelope.stamped #envelope.pen #envelope.stamped.pen #envelope.lightning #envelope.fly --- // Test conversion to string. #test(str(123), "123") #test(str(50.14), "50.14") #test(str(10 / 3).len() > 10, true) --- // Error: 6-8 expected integer, float, label, or string, found content #str([]) --- #assert(range(2, 5) == (2, 3, 4))