Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal EnableDelayedExpansion
- rem "Aacini's Colors Tree.bat": Create a safe color palette in the form of a Tree
- rem Original design by Antonio Perez Ayala
- rem Define the digits
- set base=-1
- for %%a in (00 33 66 99 CC FF) do (
- set /A base+=1
- set digit[!base!]=%%a
- )
- set /A baseM1=base-1
- rem Define the trunk
- for /L %%b in (%base%,-1,0) do (
- set a=%base%
- for /L %%a in (%base%,-1,0) do (
- if %%a neq %%b (
- set trunk[!a!][%%b]=!digit[%%a]!!digit[%%b]!!digit[%%a]!
- set /A a-=1
- )
- )
- )
- rem Generate the tree
- (
- echo =
- echo [table align="center" cellpadding="3"]
- set trunkHeight=1
- for /L %%a in (%base%,-1,1) do set /A A=%%a-1 & for /F %%A in ("!A!") do (
- rem Trunk with no branches
- set "line="
- for /L %%i in (1,1,%base%) do set "line=!line![rowspan="!trunkHeight!"][nbsp]|"
- set value=!digit[%%a]!!digit[%%a]!!digit[%%a]!
- echo !line![rowspan="!trunkHeight!" bgcolor="#!value!"]!value!
- for /L %%i in (2,1,!trunkHeight!) do echo [nbsp]
- set /A trunkHeight+=1
- rem Bunch of branches
- for /L %%b in (%base%,-1,0) do (
- set "line="
- rem Left margin
- for /L %%i in (%%a,1,%baseM1%) do set "line=!line![nbsp]|"
- rem Left branch
- for /L %%c in (0,1,%%A) do (
- set value=!digit[%%a]!!digit[%%b]!!digit[%%c]!
- set "line=!line![bgcolor="#!value!"]!value!|"
- )
- rem Trunk with branches
- set value=!trunk[%%a][%%b]!
- set line=!line![bgcolor="#!value!"]!value!
- rem Right branch
- for /L %%c in (%%A,-1,0) do (
- set value=!digit[%%c]!!digit[%%b]!!digit[%%a]!
- set "line=!line!|[bgcolor="#!value!"]!value!"
- )
- echo !line!
- )
- )
- rem Bottom trunk
- set "line="
- for /L %%i in (1,1,%base%) do set "line=!line![rowspan="!trunkHeight!"][nbsp]|"
- set value=!digit[0]!!digit[0]!!digit[0]!
- echo !line![rowspan="!trunkHeight!" bgcolor="#!value!"][color="white"]!value![/color]
- for /L %%i in (2,1,!trunkHeight!) do echo [nbsp]
- echo [/table]
- echo [color="#999999" size="-1"]Original design by Antonio Pérez Ayala[/color]
- echo [hr]
- echo [code:"Aacini's Colors Tree.bat" height:26em;]Aacini's Colors Tree.bat
- set /P "=[" < NUL
- echo /code]
- ) > "Aacini's Colors Tree.txt"
- TextToHtml "Aacini's Colors Tree.txt" /N
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement