<commit_before>(ns org.playasophy.wonderdome.util.color-test
  (:require
    [clojure.test :refer :all]
    [org.playasophy.wonderdome.util.color :as color]
    [quil.core :as quil]))


;;;;; COLOR HARNESS ;;;;;

(defn- setup-harness
  []
  (quil/frame-rate 5)
  (quil/text-font (quil/create-font "Courier" 18 true))
  (quil/background 0)
  (quil/stroke 0))


(defn- render-harness
  []
  (let [red   (color/rgb 1 0 0)  ; hue 0/3
        green (color/rgb 0 1 0)  ; hue 1/3
        blue  (color/rgb 0 0 1)] ; hue 2/3
    (quil/background 0)
    (quil/stroke 0)

    ; red, green, and blue blocks
    (quil/with-translation [20 20]
      (quil/with-translation [0 0]
        (quil/fill (color/gray 0.8))
        (quil/text "Primary colors" 0 0)
        (quil/fill red)
        (quil/rect 0 10 40 20)
        (quil/fill (color/hsv 0/3 1.0 1.0))
        (quil/rect 0 30 40 20)
        (quil/fill green)
        (quil/rect 50 10 40 20)
        (quil/fill (color/hsv 1/3 1.0 1.0))
        (quil/rect 50 30 40 20)
        (quil/fill (color/rgb 0 0 1))
        (quil/rect 100 10 40 20)
        (quil/fill (color/hsv 2/3 1.0 1.0))
        (quil/rect 100 30 40 20))

      ; RGB blending
      (quil/with-translation [170 0]
        (quil/fill (color/gray 0.8))
        (quil/text "RGB blending" 0 0)
        (quil/fill (color/blend-rgb 0.5 red green))
        (quil/rect 0 10 40 40)
        (quil/fill (color/blend-rgb 0.5 green blue))
        (quil/rect 50 10 40 40)
        (quil/fill (color/blend-rgb 0.5 blue red))
        (quil/rect 100 10 40 40))

      ; HSV blending
      (quil/with-translation [340 0]
        (quil/fill (color/gray 0.8))
        (quil/text "HSV blending" 0 0)
        (quil/fill (color/blend-hsv 0.5 red green))
        (quil/rect 0 10 40 40)
        (quil/fill (color/blend-hsv 0.5 green blue))
        (quil/rect 50 10 40 40)
        (quil/fill (color/blend-hsv 0.5 blue red))
        (quil/rect 100 10 40 40))))

    ; HSV spectrum
    (quil/with-translation [20 100]
      (quil/fill (color/gray 0.8))
      (quil/text "HSV Spectrum" 0 0)
      (let [width 480, height 100]
        (quil/fill 0)
        (quil/stroke (color/gray 0.5))
        (quil/rect 0 10 width height)
        (doseq [x (range 0 width)
                y (range 0 height)]
          (quil/stroke (color/hsv (/ x width) 1 (- 1 (/ y height))))
          (quil/point x (+ y 10)))))

    ; HSL spectrum
    (quil/with-translation [20 240]
      (quil/fill (color/gray 0.8))
      (quil/text "HSL Spectrum" 0 0)
      (let [width 480, height 100]
        (quil/fill 0)
        (quil/stroke (color/gray 0.5))
        (quil/rect 0 10 width height)
        (doseq [x (range 0 width)
                y (range 0 height)]<commit_msg>Adjust color-harness spectrums.<commit_after>(ns org.playasophy.wonderdome.util.color-test
  (:require
    [clojure.test :refer :all]
    [org.playasophy.wonderdome.util.color :as color]
    [quil.core :as quil]))


;;;;; COLOR HARNESS ;;;;;

(defn- setup-harness
  []
  (quil/frame-rate 5)
  (quil/text-font (quil/create-font "Courier" 18 true))
  ;(quil/blend-mode :blend)
  (quil/background 0)
  (quil/stroke 0))


(defn- render-harness
  []
  (let [red   (color/rgb 1 0 0)  ; hue 0/3
        green (color/rgb 0 1 0)  ; hue 1/3
        blue  (color/rgb 0 0 1)] ; hue 2/3
    (quil/background 0)
    (quil/stroke 0)

    ; red, green, and blue blocks
    (quil/with-translation [20 20]
      (quil/with-translation [0 0]
        (quil/fill (color/gray 0.8))
        (quil/text "Primary colors" 0 0)
        (quil/fill red)
        (quil/rect 0 10 40 20)
        (quil/fill (color/hsv 0/3 1.0 1.0))
        (quil/rect 0 30 40 20)
        (quil/fill green)
        (quil/rect 50 10 40 20)
        (quil/fill (color/hsv 1/3 1.0 1.0))
        (quil/rect 50 30 40 20)
        (quil/fill (color/rgb 0 0 1))
        (quil/rect 100 10 40 20)
        (quil/fill (color/hsv 2/3 1.0 1.0))
        (quil/rect 100 30 40 20))

      ; RGB blending
      (quil/with-translation [170 0]
        (quil/fill (color/gray 0.8))
        (quil/text "RGB blending" 0 0)
        (quil/fill (color/blend-rgb 0.5 red green))
        (quil/rect 0 10 40 40)
        (quil/fill (color/blend-rgb 0.5 green blue))
        (quil/rect 50 10 40 40)
        (quil/fill (color/blend-rgb 0.5 blue red))
        (quil/rect 100 10 40 40))

      ; HSV blending
      (quil/with-translation [340 0]
        (quil/fill (color/gray 0.8))
        (quil/text "HSV blending" 0 0)
        (quil/fill (color/blend-hsv 0.5 red green))
        (quil/rect 0 10 40 40)
        (quil/fill (color/blend-hsv 0.5 green blue))
        (quil/rect 50 10 40 40)
        (quil/fill (color/blend-hsv 0.5 blue red))
        (quil/rect 100 10 40 40))))

    ; HSV spectrum
    (quil/with-translation [20 100]
      (quil/fill (color/gray 0.8))
      (quil/text "HSV Spectrum" 0 0)
      (let [width 480, height 100]
        (quil/fill 0)
        (quil/stroke (color/gray 0.75))
        (quil/rect -1 9 (inc width) (inc height))
        (doseq [x (range 0 width)
                y (range 0 height)]
          (quil/stroke (color/hsv (/ x width) 1 (- 1 (/ y height))))
          (quil/point x (+ y 10)))))

    ; HSL spectrum
    (quil/with-translation [20 240]
      (quil/fill (color/gray 0.8))
      (quil/text "HSL Spectrum" 0 0)
      (let [width 480, height 100]
        (quil/fill 0)
        (quil/stroke (color/gray 0.75))
        (quil/rect -1 9 (inc width) (inc height))
        (doseq [x (range 0 width)
                y (range 0 height)]
{'fraction_non_alphanumeric': 0.14540167211922936, 'fraction_numerical': 0.08251544892766267, 'mean_word_length': 1.8351365275631117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '670491', 'n_tokens_mistral': 2546, 'n_tokens_neox': 2095, 'n_words': 607}