' Color mixer with RGB slider simulation and preview display
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL stepVal  AS LONG
    LOCAL maxStep  AS LONG
    LOCAL redVal  AS LONG
    LOCAL greenVal  AS LONG
    LOCAL blueVal  AS LONG
    LOCAL hexStr AS STRING
    LOCAL lum AS LONG

    PRINT "=== Color Mixer ==="
    PRINT

    maxStep = 10

    PRINT "--- RGB Sliders ---"
    PRINT "  Red:   0 [------------------------------] 255"
    PRINT "  Green: 0 [------------------------------] 255"
    PRINT "  Blue:  0 [------------------------------] 255"
    PRINT

    FOR stepVal = 0 TO maxStep
        redVal = (stepVal * 255) / maxStep
        greenVal = (255 - stepVal * 255 / maxStep)
        blueVal = (stepVal * 128) / maxStep
        IF redVal > 255 THEN redVal = 255
        IF greenVal < 0 THEN greenVal = 0
        IF blueVal > 255 THEN blueVal = 255

        lum = (redVal * 299 + greenVal * 587 + blueVal * 114) / 1000

        PRINT "  Step " & FORMAT$(stepVal) & ": RGB(" & FORMAT$(redVal) & "," & FORMAT$(greenVal) & "," & FORMAT$(blueVal) & ")"
        PRINT "    Hex: #" & RIGHT$("00" & HEX$(redVal), 2) & RIGHT$("00" & HEX$(greenVal), 2) & RIGHT$("00" & HEX$(blueVal), 2)
        PRINT "    Luminance: " & STR$(lum)
    NEXT stepVal
    PRINT

    PRINT "--- RGB to HSL ---"
    redVal = 100
    greenVal = 150
    blueVal = 200
    PRINT "Input: RGB(" & FORMAT$(redVal) & "," & FORMAT$(greenVal) & "," & FORMAT$(blueVal) & ")"
    PRINT "  Approx HSL: (210, 47%, 59%)"
    PRINT

    PRINT "--- Color Preview ---"
    PRINT "  [####################] RGB(64,128,192)"
    PRINT "  [####################] RGB(255,64,64)"
    PRINT

    PRINT "--- Color Schemes ---"
    PRINT "  Monochromatic: single hue, vary saturation"
    PRINT "  Complementary: hue + 180 degrees"
    PRINT "  Triadic: hue + 120, hue + 240"
    PRINT "  Analogous: hue +/- 30 degrees"

    PRINT
    PRINT "Color mixer complete."

    FUNCTION = 0
END FUNCTION
