Skip to content

Enhancement: Centralized Accent Color and Polybar Transparency Control via RiceEditor #576

@sluisr

Description

@sluisr

Problem Description

Currently, Polybar’s accent color, individual module colors (such as bspwm, launcher, bluetooth, etc.), and bar transparency cannot be configured directly through RiceEditor.
This results in visual inconsistencies when switching theme colors and limits the user’s ability to customize Polybar from a single, centralized interface.


Implemented Solution (Prototype for the yael Theme)

A working prototype was implemented in the yael theme, demonstrating the feasibility of centralized control through RiceEditor.


1. Centralization of the Accent Color (blue)

In theme-config.bash:

blue_default="#33b1ff"   # Original default theme color
blue="#33b1ff"           # Value modified by RiceEditor

export blue

In Polybar (config.ini / modules.ini):

[color]
blue = ${env:blue:#33b1ff}

All relevant Polybar modules now rely on ${env:blue} or ${color.blue}, including:

  • bspwm
  • launcher
  • bluetooth
  • pulseaudio
  • network
  • cpu_bar
  • memory_bar
  • mpd_control
  • mplayer
  • usercard
  • power
  • updates
  • xkeyboard
  • tray

In Bar.bash:

export blue

2. Restored Workspace Distinction in bspwm

In modules.ini ([module/bspwm]):

label-focused-background = ${color.blue}      ; Focused workspace
label-occupied-foreground = ${color.indigo}   ; Occupied workspace
label-empty-foreground   = ${color.grey}      ; Empty workspace
label-urgent-foreground  = ${color.blue}      ; Urgent workspace

This maintains clear workspace differentiation while staying consistent with the theme's accent color.


3. Integration into RiceEditor

  • A color picker was added (in the “Bspwm” tab) to modify the blue variable in theme-config.bash.
  • A Reset button was added, restoring the accent color using blue_default.

4. Polybar Transparency Control

In theme-config.bash:

bar_alpha="DD"   # Hex value from 00 (transparent) to FF (opaque)

In Bar.bash:

bg_color_no_hash="${bg:1}"              # Removes leading '#'
export bar_final_bg="#${bar_alpha}${bg_color_no_hash}"

In Polybar (config.ini):

background = ${env:bar_final_bg}

In RiceEditor:

  • A slider was added to adjust bar_alpha in real time.

Benefits

  • Full centralized control of Polybar’s accent color.
  • Adjustable transparency directly from RiceEditor.
  • Consistent color usage across all Polybar modules.
  • Clear visual distinction in bspwm workspaces.
  • Cleaner, theme-wide aesthetic cohesion.

Suggestion for Generalization

To maximize consistency across all themes, it is recommended to:

  • Standardize key variables (blue, blue_default, bar_alpha, etc.).
  • Ensure Theme.sh exports these variables universally.
  • Update Polybar configuration for every theme to rely on the same environment-driven color structure.

This would enable global, uniform customization through RiceEditor across the entire theme repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions