I tried this code to mix colors and may someone please describe the code to me?
@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%
I know this is part of my 1st question, but I just need help on how to use it correctly.
I'm sorry for asking this stupid question in the first place... I was doing a ton of research and some of them didnt work out properly and i was hoping for easier ways to get what I wanted. Sorry guys =(
Ohk, heres a step by step of your code:
Turns
Echo
off meaning any commands executed can't be seen by the user, instead only input and output can be seenAllows the use of
!
to Expand Variables if%
has already been ExpandedCreates a variable
hexa
with value of all valid hexadecimal digits.Takes one line of input prompting with the above text, and sets
first
to it.Takes one line of input prompting with the above text, and sets
seconds
to it.creates a variable
sum
which is set to the solution to the above equationCreates a variable
result
which is set tohexa
, from thesum
th index and one letter ahead.sets the screen colour to the hexadecimal value of
result
Outputs to the console the above text including the value of the variable
result
.That explains it quite well, and if you want this code to do something else, feel free the ask.
Mona.