4 Commits

12 changed files with 341 additions and 88 deletions

View File

@@ -1,6 +1,6 @@
# Maintainer: Daniel Dada <dan@binarygoose.dev> # Maintainer: Daniel Dada <dan@binarygoose.dev>
pkgname=clrsync pkgname=clrsync
pkgver=1.0.2 pkgver=1.0.5
pkgrel=1 pkgrel=1
pkgdesc="Color scheme manager" pkgdesc="Color scheme manager"
arch=('x86_64') arch=('x86_64')

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(clrsync VERSION 1.0.2 LANGUAGES CXX) project(clrsync VERSION 1.0.5 LANGUAGES CXX)
include(GNUInstallDirs) include(GNUInstallDirs)

View File

@@ -1 +1 @@
1.0.2 1.0.5

View File

@@ -1,32 +1,75 @@
# Extras # Extras
This directory contains additional palettes and pre-configured templates for various applications.
## Navigation
- [Palettes](#palettes)
- [Cursed](#cursed)
- [Cursed Light](#cursed-light)
- [Nord](#nord)
- [Pre-configured Templates](#pre-configured-templates)
- [Terminal Emulators](#terminal-emulators)
- [Kitty](#kitty)
- [Alacritty](#alacritty)
- [Ghostty](#ghostty)
- [Text Editors](#text-editors)
- [Neovim](#neovim)
- [Visual Studio Code](#visual-studio-code)
- [Browsers](#browsers)
- [Firefox](#firefox)
- [Applications](#applications)
- [Telegram](#telegram)
- [Desktop Themes](#desktop-themes)
- [GTK](#gtk)
- [Qt Applications](#qt-applications)
- [Window Managers](#window-managers)
- [Hyprland](#hyprland)
## Palettes ## Palettes
### Cursed ### Cursed
A dark color scheme, which tries to be like `cursed` theme by **[pyratebeard](https://pyratebeard.net)** A dark color scheme inspired by the `cursed` theme by [pyratebeard](https://pyratebeard.net).
<details>
<summary>Preview</summary>
![cursed](img/cursed.png) ![cursed](img/cursed.png)
### Cursed-light </details>
Same as `cursed`, but it also tries to be light as well ### Cursed Light
A light variant of the `cursed` color scheme.
<details>
<summary>Preview</summary>
![cursed-light](img/cursed-light.png) ![cursed-light](img/cursed-light.png)
</details>
### Nord ### Nord
Color scheme based on `Nord` A color scheme based on the `Nord` palette.
<details>
<summary>Preview</summary>
![nord](img/nord.png) ![nord](img/nord.png)
## Pre-configured templates </details>
### Kitty ## Pre-configured Templates
**1. Download [template file](templates/kitty.conf)** ### Terminal Emulators
**2. Configure template in `~/.config/clrsync/config.toml`** #### Kitty
1. Download the [template file](templates/kitty.conf)
2. Configure the template in `~/.config/clrsync/config.toml`:
```toml ```toml
[templates.kitty] [templates.kitty]
@@ -36,37 +79,17 @@ output_path = '~/.config/kitty/clrsync.conf'
reload_cmd = 'pkill -SIGUSR1 kitty' reload_cmd = 'pkill -SIGUSR1 kitty'
``` ```
**3. Import generated color scheme in `~/.config/kitty/kitty.conf** 3. Import the generated color scheme in `~/.config/kitty/kitty.conf`:
```conf ```conf
include clrsync.conf include clrsync.conf
``` ```
### Neovim #### Alacritty
**1. Download [template file](templates/nvim.lua)** 1. Download the [template file](templates/alacritty.toml)
**2. Configure template in `~/.config/clrsync/config.toml`** 2. Configure the template in `~/.config/clrsync/config.toml`:
```toml
[templates.nvim]
enabled = true
input_path = '~/.config/clrsync/templates/nvim.lua'
output_path = '~/.config/nvim/colors/clrsync.lua'
reload_cmd = ''
```
**3. Set colorscheme in neovim config**
```lua
vim.cmd.colorscheme 'clrsync'
```
### Alacritty
**1. Download [template file](templates/alacritty.toml)**
**2. Configure template in `~/.config/clrsync/config.toml`**
```toml ```toml
[templates.alacritty] [templates.alacritty]
@@ -76,18 +99,18 @@ output_path = '~/.config/alacritty/clrsync.toml'
reload_cmd = '' reload_cmd = ''
``` ```
**3. Import generated color scheme in `~/.config/alacritty/alacritty.toml** 3. Import the generated color scheme in `~/.config/alacritty/alacritty.toml`:
```toml ```toml
[general] [general]
import = ["clrsync.toml"] import = ["clrsync.toml"]
``` ```
### Ghostty #### Ghostty
**1. Download [template file](templates/ghostty)** 1. Download the [template file](templates/ghostty)
**2. Configure template in `~/.config/clrsync/config.toml`** 2. Configure the template in `~/.config/clrsync/config.toml`:
```toml ```toml
[templates.ghostty] [templates.ghostty]
@@ -97,19 +120,41 @@ output_path = '~/.config/ghostty/themes/clrsync'
reload_cmd = 'pkill -SIGUSR2 ghostty' reload_cmd = 'pkill -SIGUSR2 ghostty'
``` ```
**3. Set generated color scheme in `~/.config/ghostty/config** 3. Set the generated color scheme in `~/.config/ghostty/config`:
```toml ```conf
theme = "clrsync" theme = "clrsync"
``` ```
### Visual Studio Code ### Text Editors
**1. Install [clrsync VS Code theme](https://marketplace.visualstudio.com/items?itemName=obsqrbtz.clrsync)** #### Neovim
**2. Download [template file](templates/code.json)** 1. Download the [template file](templates/nvim.lua)
**3. Configure template in `~/.config/clrsync/config.toml`** 2. Configure the template in `~/.config/clrsync/config.toml`:
```toml
[templates.nvim]
enabled = true
input_path = '~/.config/clrsync/templates/nvim.lua'
output_path = '~/.config/nvim/colors/clrsync.lua'
reload_cmd = ''
```
3. Set the colorscheme in your Neovim config:
```lua
vim.cmd.colorscheme 'clrsync'
```
#### Visual Studio Code
1. Install the [clrsync VS Code theme](https://marketplace.visualstudio.com/items?itemName=obsqrbtz.clrsync)
2. Download the [template file](templates/code.json)
3. Configure the template in `~/.config/clrsync/config.toml`:
```toml ```toml
[templates.vscode] [templates.vscode]
@@ -119,33 +164,37 @@ output_path = '~/.vscode/extensions/obsqrbtz.clrsync-1.0.2/themes/clrsync-color-
reload_cmd = '' reload_cmd = ''
``` ```
**4. Set `clrsync` color scheme in VS Code** 4. Set the `clrsync` color scheme in VS Code
### Firefox ### Browsers
**1. Go to `about:config` and set `toolkit.legacyUserProfileCustomizations.stylesheets` to `true`** #### Firefox
**2. Go to `about:support` and find your profile directory** 1. Go to `about:config` and set `toolkit.legacyUserProfileCustomizations.stylesheets` to `true`
**3. Create `chrome` directory in your profile** 2. Go to `about:support` and find your profile directory
**4. Get [template file](templates/userChrome.css)** 3. Create a `chrome` directory in your profile
**4. Configure clrsync to output to `<profile>/chrome/userChrome.css`** 4. Download the [template file](templates/userChrome.css)
5. Configure clrsync to output to `<profile>/chrome/userChrome.css`:
```toml ```toml
[templates.firefox] [templates.firefox]
enabled = true enabled = true
input_path = '~/.config/clrsync/templates/firefox.json' input_path = '~/.config/clrsync/templates/userChrome.css'
output_path = '<profile directory>\chrome\userChrome.css' output_path = '<profile directory>/chrome/userChrome.css'
reload_cmd = '' reload_cmd = ''
``` ```
### Telegram ### Applications
**1. Get the [template file](templates/telegram.tdesktop-theme)** #### Telegram
**2. Configure template in `~/.config/clrsync/config.toml`** 1. Download the [template file](templates/telegram.tdesktop-theme)
2. Configure the template in `~/.config/clrsync/config.toml`:
```toml ```toml
[templates.telegram] [templates.telegram]
@@ -155,7 +204,105 @@ output_path = '~/clrsync.tdesktop-theme'
reload_cmd = '' reload_cmd = ''
``` ```
**3. Apply palette with clrsync and send generated `clrsync.tdesktop-theme` to yourself in telegram** 3. Apply the palette with clrsync and send the generated `clrsync.tdesktop-theme` file to yourself in Telegram
**4. Click on the theme in the telegram dialogue to apply** 4. Click on the theme file in the Telegram dialog to apply it
### Desktop Themes
#### GTK
1. Download the [template file](templates/gtk.css)
2. Configure the template in `~/.config/clrsync/config.toml`:
```toml
[templates.gtk3]
enabled = true
input_path = '~/.config/clrsync/templates/gtk.css'
output_path = '~/.config/gtk-3.0/colors.css'
reload_cmd = ''
[templates.gtk4]
enabled = true
input_path = '~/.config/clrsync/templates/gtk.css'
output_path = '~/.config/gtk-4.0/colors.css'
reload_cmd = ''
```
3. Import the color scheme at the top of `~/.config/gtk-3.0/gtk.css`, `~/.config/gtk-4.0/gtk.css`, and `~/.config/gtk-4.0/gtk-dark.css`:
```css
@import 'colors.css';
```
#### Qt Applications
1. Download the templates:
- Kvantum: [kvantum.kvconfig](templates/kvantum/kvantum.kvconfig) and [kvantum.svg](templates/kvantum/kvantum.svg)
- Qt5ct/Qt6ct: [qtct.conf](templates/qtct.conf)
2. Configure the templates in `~/.config/clrsync/config.toml`:
```toml
[templates.kvantum]
enabled = true
input_path = '~/.config/clrsync/templates/kvantum/kvantum.kvconfig'
output_path = '~/.config/Kvantum/clrsync/clrsync.kvconfig'
reload_cmd = ''
[templates.kvantum-svg]
enabled = true
input_path = '~/.config/clrsync/templates/kvantum/kvantum.svg'
output_path = '~/.config/Kvantum/clrsync/clrsync.svg'
reload_cmd = ''
[templates.qt5ct]
enabled = true
input_path = '~/.config/clrsync/templates/qtct.conf'
output_path = '~/.config/qt5ct/colors/clrsync.conf'
reload_cmd = ''
[templates.qt6ct]
enabled = true
input_path = '~/.config/clrsync/templates/qtct.conf'
output_path = '~/.config/qt6ct/colors/clrsync.conf'
reload_cmd = ''
```
3. Set the theme in `~/.config/Kvantum/kvantum.kvconfig`:
```conf
[General]
theme=clrsync
```
4. Set the theme in `~/.config/qt5ct/qt5ct.conf` and `~/.config/qt6ct/qt6ct.conf`:
```conf
[Appearance]
color_scheme_path=$HOME/.config/qt5ct/colors/clrsync.conf
custom_palette=true
```
### Window Managers
#### Hyprland
1. Download the [template file](templates/hyprland.conf)
2. Configure the template in `~/.config/clrsync/config.toml`:
```toml
[templates.hyprland]
enabled = true
input_path = '~/.config/clrsync/templates/hyprland.conf'
output_path = '~/.config/hypr/hyprland/clrsync.conf'
reload_cmd = ''
```
3. Source the color theme in your Hyprland config:
```conf
source=~/.config/hypr/hyprland/clrsync.conf
```

View File

@@ -1,18 +1,88 @@
@define-color accent_color {accent}; @define-color accent_color {accent};
@define-color accent_bg_color {accent}; @define-color accent_bg_color {accent};
@define-color accent_fg_color {on_surface}; @define-color accent_fg_color {on_surface};
@define-color destructive_color {error};
@define-color destructive_bg_color {error};
@define-color destructive_fg_color {on_error};
@define-color success_color {success};
@define-color success_bg_color {success};
@define-color success_fg_color {on_success};
@define-color warning_color {warning};
@define-color warning_bg_color {warning};
@define-color warning_fg_color {on_warning};
@define-color error_color {error};
@define-color error_bg_color {error};
@define-color error_fg_color {on_error};
@define-color window_bg_color {background}; @define-color window_bg_color {background};
@define-color window_fg_color {foreground}; @define-color window_fg_color {on_background};
@define-color headerbar_bg_color {surface};
@define-color headerbar_fg_color {on_surface};
@define-color popover_bg_color {surface_variant};
@define-color popover_fg_color {on_surface_variant};
@define-color view_bg_color {background}; @define-color view_bg_color {background};
@define-color view_fg_color {foreground}; @define-color view_fg_color {foreground};
@define-color card_bg_color {surface}; @define-color headerbar_bg_color {surface};
@define-color card_fg_color {on_surface}; @define-color headerbar_fg_color {on_surface};
@define-color headerbar_border_color {border};
@define-color headerbar_backdrop_color @window_bg_color;
@define-color headerbar_shade_color {border};
@define-color sidebar_bg_color {surface_variant}; @define-color sidebar_bg_color {surface_variant};
@define-color sidebar_fg_color {on_surface}; @define-color sidebar_fg_color {on_surface};
@define-color sidebar_border_color @window_bg_color; @define-color sidebar_border_color {border};
@define-color sidebar_backdrop_color @window_bg_color; @define-color sidebar_backdrop_color @window_bg_color;
@define-color sidebar_shade_color {border};
@define-color card_bg_color {surface};
@define-color card_fg_color {on_surface};
@define-color card_shade_color {border};
@define-color dialog_bg_color {surface};
@define-color dialog_fg_color {on_surface};
@define-color popover_bg_color {surface_variant};
@define-color popover_fg_color {on_surface_variant};
@define-color shade_color {border};
@define-color scrollbar_outline_color {border};
@define-color blue_1 {base0C};
@define-color blue_2 {base04};
@define-color blue_3 {base04};
@define-color blue_4 {base04};
@define-color blue_5 {base04};
@define-color green_1 {success};
@define-color green_2 {success};
@define-color green_3 {success};
@define-color green_4 {base02};
@define-color green_5 {base02};
@define-color yellow_1 {base0B};
@define-color yellow_2 {base03};
@define-color yellow_3 {base03};
@define-color yellow_4 {base03};
@define-color yellow_5 {base03};
@define-color orange_1 {warning};
@define-color orange_2 {warning};
@define-color orange_3 {warning};
@define-color orange_4 {warning};
@define-color orange_5 {warning};
@define-color red_1 {error};
@define-color red_2 {error};
@define-color red_3 {error};
@define-color red_4 {base01};
@define-color red_5 {base01};
@define-color purple_1 {base0D};
@define-color purple_2 {base05};
@define-color purple_3 {base05};
@define-color purple_4 {base05};
@define-color purple_5 {base05};
@define-color brown_1 {base0E};
@define-color brown_2 {base0E};
@define-color brown_3 {base0E};
@define-color brown_4 {base0E};
@define-color brown_5 {base0E};
@define-color light_1 {on_background};
@define-color light_2 {on_surface};
@define-color light_3 {on_surface_variant};
@define-color light_4 {border};
@define-color light_5 {border};
@define-color dark_1 {border};
@define-color dark_2 {surface_variant};
@define-color dark_3 {surface};
@define-color dark_4 {background};
@define-color dark_5 {base00};
scale trough highlight {
background: {accent}
}

View File

@@ -1,9 +1,9 @@
$primary = rgb({accent_stripped}) $primary = rgb({accent.hex_stripped})
$surface = rgb({surface_stripped}) $surface = rgb({surface.hex_stripped})
$secondary = rgb({base04_stripped}) $secondary = rgb({base04.hex_stripped})
$error = rgb({error_stripped}) $error = rgb({error.hex_stripped})
$tertiary = rgb({base06_stripped}) $tertiary = rgb({base06.hex_stripped})
$surface_lowest = rgb({background_stripped}) $surface_lowest = rgb({background.hex_stripped})
general { general {
col.active_border = $primary col.active_border = $primary

View File

@@ -76,7 +76,7 @@ menu_blur_radius=0
tooltip_blur_radius=0 tooltip_blur_radius=0
[GeneralColors] [GeneralColors]
window.color={surface} window.color={background}
base.color={surface} base.color={surface}
alt.base.color={surface} alt.base.color={surface}
button.color={surface_variant} button.color={surface_variant}
@@ -86,14 +86,14 @@ dark.color={surface_variant}
mid.color={surface_variant} mid.color={surface_variant}
highlight.color={accent} highlight.color={accent}
inactive.highlight.color={accent} inactive.highlight.color={accent}
text.color={on_surface} text.color={on_background}
window.text.color={on_surface} window.text.color={on_background}
button.text.color={on_surface} button.text.color={on_surface_variant}
disabled.text.color={editor_disabled} disabled.text.color={editor_disabled}
tooltip.text.color={on_surface} tooltip.text.color={on_surface}
highlight.text.color={on_surface} highlight.text.color={on_surface}
link.color={base06} link.color={base04}
link.visited.color={base0D} link.visited.color={base05}
progress.indicator.text.color={on_surface} progress.indicator.text.color={on_surface}
[Hacks] [Hacks]

View File

@@ -6,7 +6,7 @@
namespace clrsync::core namespace clrsync::core
{ {
const std::string GIT_SEMVER = "1.0.1+git.g9803f49"; const std::string GIT_SEMVER = "1.0.4+git.g2b1c6d5";
const std::string version_string(); const std::string version_string();
} // namespace clrsync::core } // namespace clrsync::core

View File

@@ -16,6 +16,11 @@ glfw_opengl_backend::~glfw_opengl_backend()
glfw_opengl_backend::shutdown(); glfw_opengl_backend::shutdown();
} }
void glfw_opengl_backend::focus_callback(GLFWwindow*, int focused)
{
glfwSwapInterval(focused ? 1 : 0);
}
bool glfw_opengl_backend::initialize(const window_config &config) bool glfw_opengl_backend::initialize(const window_config &config)
{ {
glfwSetErrorCallback([](int error, const char* description) { glfwSetErrorCallback([](int error, const char* description) {
@@ -48,6 +53,7 @@ bool glfw_opengl_backend::initialize(const window_config &config)
glfwMakeContextCurrent(m_window); glfwMakeContextCurrent(m_window);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetWindowFocusCallback(m_window, focus_callback);
return true; return true;
} }

View File

@@ -32,6 +32,8 @@ namespace clrsync::gui::backend{
void imgui_render_draw_data(void* draw_data) override; void imgui_render_draw_data(void* draw_data) override;
private: private:
static void focus_callback(GLFWwindow* window, int focused);
GLFWwindow* m_window = nullptr; GLFWwindow* m_window = nullptr;
}; };
} }

View File

@@ -3,6 +3,7 @@
#include "gui/platform/file_browser.hpp" #include "gui/platform/file_browser.hpp"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <filesystem> #include <filesystem>
#include <GLFW/glfw3.h>
namespace file_dialogs namespace file_dialogs
{ {
@@ -38,7 +39,16 @@ std::string open_file_dialog(const std::string &title, const std::string &initia
} }
std::string result; std::string result;
if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(native)) == GTK_RESPONSE_ACCEPT)
gint response = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
while (gtk_events_pending())
{
gtk_main_iteration();
glfwPollEvents();
}
if (response == GTK_RESPONSE_ACCEPT)
{ {
char *filename = gtk_file_chooser_get_filename(chooser); char *filename = gtk_file_chooser_get_filename(chooser);
if (filename) if (filename)
@@ -79,7 +89,16 @@ std::string save_file_dialog(const std::string &title, const std::string &initia
} }
std::string result; std::string result;
if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(native)) == GTK_RESPONSE_ACCEPT)
gint response = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
while (gtk_events_pending())
{
gtk_main_iteration();
glfwPollEvents();
}
if (response == GTK_RESPONSE_ACCEPT)
{ {
char *filename = gtk_file_chooser_get_filename(chooser); char *filename = gtk_file_chooser_get_filename(chooser);
if (filename) if (filename)
@@ -113,7 +132,16 @@ std::string select_folder_dialog(const std::string &title, const std::string &in
} }
std::string result; std::string result;
if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(native)) == GTK_RESPONSE_ACCEPT)
gint response = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
while (gtk_events_pending())
{
gtk_main_iteration();
glfwPollEvents();
}
if (response == GTK_RESPONSE_ACCEPT)
{ {
char *filename = gtk_file_chooser_get_filename(chooser); char *filename = gtk_file_chooser_get_filename(chooser);
if (filename) if (filename)

View File

@@ -6,6 +6,7 @@
#include <algorithm> #include <algorithm>
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
#include <imgui.h> #include <imgui.h>
#include <GLFW/glfw3.h>
std::string font_loader::find_font_linux(const char *font_name) std::string font_loader::find_font_linux(const char *font_name)
{ {
@@ -64,7 +65,6 @@ void font_loader::pop_font()
std::vector<std::string> font_loader::get_system_fonts() std::vector<std::string> font_loader::get_system_fonts()
{ {
std::vector<std::string> fonts; std::vector<std::string> fonts;
FcInit(); FcInit();
FcPattern *pattern = FcPatternCreate(); FcPattern *pattern = FcPatternCreate();
FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, nullptr); FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, nullptr);