-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_colors_pattern.sh
executable file
·58 lines (47 loc) · 1.41 KB
/
generate_colors_pattern.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Location of the colorsPattern.css file
CSS_FILE="./public/colorsPattern.css"
OUTPUT_FILE="./public/colorsPattern.css"
# Check if the CSS file exists
if [[ ! -f "$CSS_FILE" ]]; then
echo "Error: $CSS_FILE does not exist."
exit 1
fi
# Define an array to hold the color variables
color_variables=(
"primary-text"
"primary-text-h"
"secondary-text"
"link-c"
"bg-primary-button"
"primary-button-b"
"bg-primary-button-h"
"txt-primary-button"
"bg-secondary-button"
"bg-secondary-button-h"
"secondary-button-b"
"txt-secondary-button"
"txt-input"
"txt-input-b"
"bg-input"
"input-f"
"ph-input"
)
# Start generating the CSS content
css_content="@layer colorConfig {\n :root {\n"
# Prompt for each color
for var in "${color_variables[@]}"; do
# Define the default color as a variable
default_color="var(--DEFAULT-$var)"
# Prompt the user for a color
read -p "Enter a color for $var (default: $default_color): " user_color
# Use the user input or the default color if input is empty
color_to_use="${user_color:-$default_color}"
# Append the color definition to the CSS content
css_content+=" --$var: $color_to_use;\n"
done
# Finish the CSS content
css_content+=" }\n}"
# Write the generated CSS to the output file
echo -e "$css_content" > "$OUTPUT_FILE"
echo "Generated color configuration in $OUTPUT_FILE."