summaryrefslogtreecommitdiff
path: root/src/update_polybar.py
blob: 2ea16afde93552f7af9912b9d118ef1953429791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24


def updatePolybarTheme(config_path: str, colors: list, compliments: list):
    print('[bold red]Updating polybar color scheme')
    data = ''
    with open(config_path, 'r') as file:
        data = file.readlines()
    for i,line in enumerate(data):
        #update colors
        if "rice-background =" in line:
            data[i] = 'rice-background = ' + colors[0] + '\n'
        if "rice-background-alt =" in line:
            data[i] = 'rice-background-alt = ' + colors[1] + '\n'
        if "rice-foreground =" in line:
            data[i] = 'rice-foreground = ' + compliments[0] + '\n'
        if "rice-primary =" in line:
            data[i] = 'rice-primary = ' + compliments[1] + '\n'
        if "rice-secondary =" in line:
            data[i] = 'rice-secondary = ' + compliments[2] + '\n'
        if "rice-disabled =" in line:
            data[i] = 'rice-disabled = ' + colors[2] + '\n'
    with open(config_path, 'w') as file:
        file.writelines(data)