You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* // The contrast checker can be used both during development
320
+
* // with `print()`, or to help select readable colors on the fly.
321
+
* // This example shows both uses.
322
+
*
323
+
* let bgColor;
324
+
* let fg1Color;
325
+
* let fg2Color;
326
+
*
306
327
* function setup() {
307
-
* // Define colors
308
-
* let color1 = color(255, 255, 255);
309
-
* let color2 = color(0);
310
-
*
311
-
* // Test for contrast
312
-
* let result = color1.contrast(color2)
328
+
* createCanvas(100, 100);
329
+
* bgColor = color(0);
330
+
* fg1Color = color(120);
331
+
* fg2Color = color(255);
332
+
*
333
+
* describe('A small square canvas with acentered text outlined by a thick stroke. The text reads 'click again!'. On every mouse click, the background, square outline, and text colors randomize, with high enough contrast for readability.');
334
+
* }
313
335
*
314
-
* console.log(result)
336
+
* function draw() {
337
+
* background(bgColor);
338
+
* stroke(fg1Color);
339
+
* noFill();
340
+
* strokeWeight(5);
341
+
* rect(10, 10, 80, 80);
315
342
*
343
+
* noStroke();
344
+
* fill(fg2Color);
345
+
* textAlign(CENTER, CENTER);
346
+
* textSize(20);
347
+
* text("click\nagain!", 50, 50);
348
+
* }
349
+
*
350
+
* function mouseClicked(){
351
+
* let newBgColor;
352
+
* let newFg1Color;
353
+
* let newFg2Color;
354
+
*
355
+
* // The loop may go for a long time, but it will not go on forever
356
+
* // It will stop the first time that the random colors contrast enough
0 commit comments