Skip to content

[FEAT] - Custom Theme Support #21

Description

@bakayu

Add Custom Theme Support via Configuration Files

Current Behavior:

Themes are currently hardcoded within the application, offering a limited set of predefined options. Check - internal/tui/theme.go

Desired Behavior:

Implement a system that allows users to create and use their own custom themes by placing theme configuration files in a designated directory within their .config folder (e.g., ~/.config/gitx/config.toml). This will enable greater personalization and flexibility.

  • Use toml as the config file format. (Open for discussion)
  • This would involve adding functionality to check if a file exists at ~/.config/gitx/config.toml. (If it doesn't exist gitx should not bother loading the user provided themes).
  • If a file is found, that is ~/.config/gitx/config.toml. It should contain a format as such:
# Default: "GitHub Dark"
theme = "GitHub Dark"
  • If a theme is provided in the config.toml file, it would check if it's an inbuilt theme and default to that, if not it would check whether a matching theme is found in themes subdirectory.
  • The theme config file should include a format like such:
# General foreground and background colors
Fg = "#ebdbb2"
Bg = "#282828"

# Normal colors
[normal]
Black   = "#282828"
Red     = "#cc241d"
Green   = "#98971a"
Yellow  = "#d79921"
Blue    = "#458588"
Magenta = "#b16286"
Cyan    = "#689d6a"
White   = "#a89984"

# Bright colors
[bright]
Black   = "#928374"
Red     = "#fb4934"
Green   = "#b8bb26"
Yellow  = "#fabd2f"
Blue    = "#83a598"
Magenta = "#d3869b"
Cyan    = "#8ec07c"
White   = "#ebdbb2"

# Dark colors
[dark]
Black   = "#1d2021"
Red     = "#9d0006"
Green   = "#79740e"
Yellow  = "#b57614"
Blue    = "#076678"
Magenta = "#8f3f71"
Cyan    = "#427b58"
White   = "#928374"
  • The final config file structure should look like this:
.config/
└ gitx/
    ├ config.toml
    └ themes/
        └ my_custom_theme.toml

Tip

The desired behavior is open to discussion, if you think a better approach or behavior would be better, let us know!

PR Acceptance Criteria:

  • gitx must be able to load custom theme files from a ~/.config/gitx/themes directory.
  • A clear and well-documented format for theme configuration files must be created and added to the project's documentation.
  • Users should be able to switch between both built-in and custom themes from within the application.
  • Attach a screenshot or short video showcasing a custom theme being loaded and applied.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    HARDThis bug/feature request requires deep understanding of the problem and the codebase.enhancementNew feature or requesthacktoberfestIssue is up for grabs for hacktoberfestlanguage/goRequires the knowledge of "Go"

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions