# Only white keys to black



## jesusginard (Sep 17, 2013)

I want to turn all keys to black, I do this: 


```
on init
    declare $i := 0
    while($i < 128)
        set_key_color($i,$KEY_COLOR_BLACK)
        inc($i)
    end while
end on
```

This inverts the color of all keys so the black keys appear white, but I want the keyboard to appear completely black. I would need to change the color of only the white keys. I can't come up with a solution other than doing it manually for each key. Is there any automatic method?


----------



## andreasOL (Sep 17, 2013)

Try this 


```
on init
    declare %white_keys[7] := (0, 2, 4, 5, 7, 9, 11)
    declare $i := 0
    while($i < 128)
        if (search(%white_keys, $i mod 12) # -1)
            set_key_color($i,$KEY_COLOR_BLACK)
        end if
        inc($i)
    end while
end on
```


----------



## jesusginard (Sep 17, 2013)

Woohoo!

I don't fully understand it but it's working! Thank you very much!


----------



## mk282 (Sep 17, 2013)

Think about it a bit and it will become very obvious.


----------

