i made this #Swatch(https://codepen.io/ricoThaka/pen/YzMVdXj?editors=1100 <~) i want to expand it to a flexible layout that can contain unlimited colors for the swatch
`
.swatch div:nth-child(1) { background: DeepPink;}
.swatch div:nth-child(2) { background: cyan;}
.swatch div:nth-child(3) { background: GreenYellow;}
.swatch div:nth-child(4) { background: CornflowerBlue;}
.swatch div:nth-child(5) { background: Coral;}
`
Thats the values that i want to exponentially increment and manipulate in a nice #CSSGRid that kinda spider webs to my wife phone screen, thats how we talk @normani
` i=1
until [ $i -gt 8 ];
do
echo ".swatch div:nth-child($i){ background: ;}"
((i=i+1))
done
.swatch div:nth-child(1){ background: ;}
.swatch div:nth-child(2){ background: ;}
.swatch div:nth-child(3){ background: ;}
.swatch div:nth-child(4){ background: ;}
.swatch div:nth-child(5){ background: ;}
.swatch div:nth-child(6){ background: ;}
.swatch div:nth-child(7){ background: ;}
.swatch div:nth-child(8){ background: ;}
`
how do i get the background hex values loaded? im storing them in a file ~>
` ``` for i in `cat colorvalues.csv`; do echo "$i"; done ```
#9acd32
#efcc00
#ffd300
#ffae42
#ffef00
#fefe33
#0014a8
#2c1608... like i want to feed that list like this
.swatch div:nth-child(1){ background: #xxxxxx ;}
.swatch div:nth-child(2){ background: #xxxxxx ;}
.swatch div:nth-child(3){ background: #xxxxxx ;}
.swatch div:nth-child(4){ background: #xxxxxx ;}
`
#BASH_iNTERPETER = https://www.onlinegdb.com/edit/0LXwgPkFV
its supposed to create a bunch of divs i just paste into my css file the divs in the html r empty enter image description here
`
i=1
until [ $i -gt 8 ];
do
echo ".swatch div:nth-child($i){ background: ;}"
((i=i+1))
done
.swatch div:nth-child(1){ background: ;}
.swatch div:nth-child(2){ background: ;}
.swatch div:nth-child(3){ background: ;}
.swatch div:nth-child(4){ background: ;}
.swatch div:nth-child(5){ background: ;}
.swatch div:nth-child(6){ background: ;}
.swatch div:nth-child(7){ background: ;}
.swatch div:nth-child(8){ background: ;}
...Program finished with exit code 0
Press ENTER to exit console.`
2
Answers
You’re close. Maybe something like:
If the main requirement is to take lines from
colorvalue.csv
and generate a series of.swatch div:...
lines:This generates:
NOTE: I’m guessing this is the desired output since OP hasn’t (yet) provided the expected output