Batch file Mixing multiple colors

528 views Asked by At

I've been wondering if someone have made a batch file utility that can mix 2 batch colors into another color (for example: Red + Yellow to make Orange). I don't really know if its even possible or not to do such a thing, but if there is, I want to know.

1

There are 1 answers

0
Aacini On BEST ANSWER

Well, if with "batch colors" you refer to color values of color command, then it is very easy to get some equivalences based on the original color table shown by color /? command:

0 = Black       8 = Gray
1 = Blue        9 = Light blue
2 = Green       A = Light green
3 = Aqua        B = Light aqua
4 = Red         C = Light red
5 = Magenta     D = Light magenta
6 = Brown       E = Yellow
7 = White       F = Bright white

(perhaps color names are not the same of color /? command, I am translating they from my Spanish Windows)

This way, we may see that Red+Yellow (4+E = 12 mod F = 2) gives Green!

@echo off
setlocal EnableDelayedExpansion
set hexa=0123456789ABCDEF
set /P "first=Enter first color (hexa digit): "
set /P "second=Enter second color (hexa digit): "
set /A sum= (0x%first% + 0x%second%) %% 16
set result=!hexa:~%sum%,1!
color %result%
echo The result is: %result%