forked from Shinonome/dots-hyprland
updaed pywal dependancy added kvantum theming and pywal also changes some configs
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import webcolors
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
color_path = os.path.expanduser("~/.cache/wal/colors")
|
||||
|
||||
|
||||
# Define the mapping of your desired colors
|
||||
color_map = {
|
||||
"black": "#4F4F4F",
|
||||
"blue": "#5294E2",
|
||||
"bluegrey": "#607D8B",
|
||||
"breeze": "#57B8EC",
|
||||
"brown": "#AE8E6C",
|
||||
"carmine": "#A30002",
|
||||
"cyan": "#00BCD4",
|
||||
"darkcyan": "#36858E",
|
||||
"deeporange": "#EB6637",
|
||||
"green": "#87B158",
|
||||
"grey": "#8E8E8E",
|
||||
"indigo": "#5C6BC0",
|
||||
"magenta": "#CA71E0",
|
||||
"nordic": "#81A1C1",
|
||||
"orange": "#EE923A",
|
||||
"palebrown": "#D1BFAE",
|
||||
"paleorange": "#EECA8F",
|
||||
"pink": "#F16293",
|
||||
"red": "#E25252",
|
||||
"teal": "#16A085",
|
||||
"violet": "#7E57C2",
|
||||
"white": "#E5E5E5",
|
||||
"adwaita": "#93C0EA",
|
||||
"yellow": "#F9BD30",
|
||||
}
|
||||
|
||||
# Convert color_map to RGB tuples
|
||||
color_map_rgb = {
|
||||
name: webcolors.hex_to_rgb(hex_code) for name, hex_code in color_map.items()
|
||||
}
|
||||
|
||||
|
||||
def closest_color(requested_color):
|
||||
min_colors = {}
|
||||
for name, rgb in color_map_rgb.items():
|
||||
rd = (rgb[0] - requested_color[0]) ** 2
|
||||
gd = (rgb[1] - requested_color[1]) ** 2
|
||||
bd = (rgb[2] - requested_color[2]) ** 2
|
||||
min_colors[(rd + gd + bd)] = name
|
||||
return min_colors[min(min_colors.keys())]
|
||||
|
||||
|
||||
def get_color_name(hex_color):
|
||||
requested_color = webcolors.hex_to_rgb(hex_color)
|
||||
closest_name = closest_color(requested_color)
|
||||
return closest_name
|
||||
|
||||
|
||||
# Read hex codes from .cache/wal/colors file
|
||||
with open(color_path, "r") as file:
|
||||
hex_codes = [line.strip() for line in file]
|
||||
|
||||
# Get the nearest color name for each hex code
|
||||
color_names = [get_color_name(hex_code) for hex_code in hex_codes]
|
||||
|
||||
# Get the name of the 4th color
|
||||
color_name = color_names[2]
|
||||
print(f"The 4th color is closest to: {color_name}")
|
||||
|
||||
# Execute the papirus-folders command with the closest color name
|
||||
subprocess.run(["papirus-folders", "-C", color_name, "--theme", "Papirus-Dark"])
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define formatting variables
|
||||
GREEN='\033[1;32m'
|
||||
NC='\033[0m' # No Color
|
||||
GLYPH=''
|
||||
|
||||
# Execute other commands
|
||||
|
||||
# echo -e "\n${GREEN}${GLYPH} Running colors-foot.py ${NC}"
|
||||
# python ~/.config/hypr/scripts/colors-foot.py
|
||||
|
||||
echo -e "\n${GREEN}${GLYPH} Running colors-folders.py (for papirus colored folders).${NC}"
|
||||
python ~/.config/pywal/colors-folders.py
|
||||
|
||||
echo -e "\n${GREEN}${GLYPH} Generating rofi colors ${NC}"
|
||||
python ~/.config/pywal/rofi-colors.py
|
||||
|
||||
# echo -e "\n${GREEN}${GLYPH} Generating sddm colors ${NC}"
|
||||
# ~/.config/pywal/sddm-pywal
|
||||
|
||||
# echo -e "\n${GREEN}${GLYPH} Generating Ghostty terminal colors ${NC}"
|
||||
# python ~/.config/pywal/ghosttyPywal.py
|
||||
|
||||
echo -e "\n${GREEN}${GLYPH} changing spotiify theme (text) ${NC}"
|
||||
pywal-spicetify text
|
||||
# spicetify apply
|
||||
|
||||
echo -e "\n${GREEN}${GLYPH} Running walogram (for telegram) ${NC}"
|
||||
walogram -s
|
||||
|
||||
echo -e "\n${GREEN}${GLYPH} Running pywal-discord (for discord) ${NC}"
|
||||
pywal-discord
|
||||
|
||||
echo -e "\n${GREEN}${GLYPH} Script execution completed.${NC}"
|
||||
@@ -0,0 +1,49 @@
|
||||
import yaml
|
||||
import os
|
||||
|
||||
def read_yaml(file_path):
|
||||
"""Reads a YAML file and returns its content."""
|
||||
with open(file_path, 'r') as file:
|
||||
data = yaml.safe_load(file)
|
||||
return data
|
||||
|
||||
def format_colors(colors):
|
||||
"""Formats the colors into the required output style."""
|
||||
output = []
|
||||
|
||||
# Format palette colors
|
||||
for index, (color_key, color_value) in enumerate(colors['colors'].items()):
|
||||
output.append(f"palette = {index}={color_value}")
|
||||
|
||||
# Format special colors
|
||||
output.append(f"background = {colors['special']['background'][1:]}")
|
||||
output.append(f"foreground = {colors['special']['foreground'][1:]}")
|
||||
output.append(f"cursor-color = {colors['special']['cursor'][1:]}")
|
||||
output.append(f"selection-background = {colors['special']['background'][1:]}")
|
||||
output.append(f"selection-foreground = {colors['special']['foreground'][1:]}")
|
||||
|
||||
return output
|
||||
|
||||
def write_config(config_path, formatted_colors):
|
||||
"""Writes the formatted colors to the configuration file."""
|
||||
with open(config_path, 'w') as config_file:
|
||||
for line in formatted_colors:
|
||||
config_file.write(line + '\n')
|
||||
print("Colors have been generated and saved to the configuration file!")
|
||||
|
||||
def main():
|
||||
yaml_file = os.path.expanduser('~/.cache/wal/colors.yml') # Replace with the path to your YAML file
|
||||
config_file = os.path.expanduser('~/.config/ghostty/colors') # Replace with the path to your terminal configuration file
|
||||
|
||||
# Read colors from the YAML file
|
||||
colors = read_yaml(yaml_file)
|
||||
|
||||
# Format colors
|
||||
formatted_colors = format_colors(colors)
|
||||
|
||||
# Write the formatted colors to the terminal configuration file
|
||||
write_config(config_file, formatted_colors)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import re
|
||||
import os
|
||||
|
||||
# Define the input SCSS file and output Rasi file
|
||||
input_file = os.path.expanduser('~/.local/state/ags/scss/_material.scss')
|
||||
output_file = os.path.expanduser('~/.config/rofi/colors.rasi')
|
||||
|
||||
def convert_scss_to_rasi(input_file, output_file):
|
||||
# Read the SCSS file
|
||||
with open(input_file, 'r') as file:
|
||||
scss_content = file.read()
|
||||
|
||||
# Remove specific SCSS variables
|
||||
variables_to_remove = [
|
||||
r'\$darkmode:.*;\n',
|
||||
r'\$transparent:.*;\n',
|
||||
r'\$primary_paletteKeyColor:.*;\n',
|
||||
r'\$secondary_paletteKeyColor:.*;\n',
|
||||
r'\$tertiary_paletteKeyColor:.*;\n',
|
||||
r'\$neutral_paletteKeyColor:.*;\n',
|
||||
r'\$neutral_variant_paletteKeyColor:.*;\n'
|
||||
]
|
||||
for var in variables_to_remove:
|
||||
scss_content = re.sub(var, '', scss_content)
|
||||
|
||||
# Convert remaining SCSS variables to Rasi format
|
||||
rasi_content = re.sub(r'\$(\w+):\s*(.*);', r' \1: \2;', scss_content)
|
||||
|
||||
# Add the Rasi header and footer with spaces around content
|
||||
rasi_content = '* {\n\n' + rasi_content + '\n\n}'
|
||||
|
||||
# Write the Rasi content to a file
|
||||
with open(output_file, 'w') as file:
|
||||
file.write(rasi_content)
|
||||
|
||||
print(f"Conversion complete! Check the '{output_file}' file.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
convert_scss_to_rasi(input_file, output_file)
|
||||
|
||||
Reference in New Issue
Block a user