mirror of
https://github.com/obsqrbtz/clrsync.git
synced 2026-04-08 20:19:04 +03:00
updated generator cli arg
This commit is contained in:
58
README.md
58
README.md
@@ -41,6 +41,7 @@ A theme management tool for synchronizing color schemes across multiple applicat
|
|||||||
- **CLI & GUI**: Choose between a command-line interface or a graphical editor
|
- **CLI & GUI**: Choose between a command-line interface or a graphical editor
|
||||||
- **Live Reload**: Define post-apply hooks (configurable per template)
|
- **Live Reload**: Define post-apply hooks (configurable per template)
|
||||||
- **Flexible Color Formats**: Support for HEX, RGB, HSL with multi-component access (e.g., `{color.r}`, `{color.hex}`, `{color.hsl}`)
|
- **Flexible Color Formats**: Support for HEX, RGB, HSL with multi-component access (e.g., `{color.r}`, `{color.hex}`, `{color.hsl}`)
|
||||||
|
- **Color generation**: integration with `hellwal` and `matugen`
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -421,6 +422,8 @@ Format colors using dot notation:
|
|||||||
|
|
||||||
### CLI
|
### CLI
|
||||||
|
|
||||||
|
#### Basic Commands
|
||||||
|
|
||||||
List available themes:
|
List available themes:
|
||||||
```bash
|
```bash
|
||||||
clrsync_cli --list-themes
|
clrsync_cli --list-themes
|
||||||
@@ -451,6 +454,61 @@ Use a custom config file:
|
|||||||
clrsync_cli --config /path/to/config.toml --apply
|
clrsync_cli --config /path/to/config.toml --apply
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Palette Generation
|
||||||
|
|
||||||
|
Generate a palette from an image:
|
||||||
|
```bash
|
||||||
|
clrsync_cli --generate /path/to/image.png
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate a palette from a color (hex):
|
||||||
|
```bash
|
||||||
|
clrsync_cli --generate-color "#B44242" --generator matugen
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Generator Options
|
||||||
|
|
||||||
|
**Hellwal Generator** (default):
|
||||||
|
```bash
|
||||||
|
clrsync_cli --generate image.png --generator hellwal --hellwal-neon --hellwal-dark
|
||||||
|
```
|
||||||
|
|
||||||
|
Available hellwal options:
|
||||||
|
- `--hellwal-neon` - Enable neon mode
|
||||||
|
- `--hellwal-dark` - Prefer dark palettes
|
||||||
|
- `--hellwal-light` - Prefer light palettes
|
||||||
|
- `--hellwal-color` - Enable color mode
|
||||||
|
- `--hellwal-invert` - Invert colors
|
||||||
|
- `--hellwal-dark-offset <float>` - Dark offset (default: 0.0)
|
||||||
|
- `--hellwal-bright-offset <float>` - Bright offset (default: 0.0)
|
||||||
|
- `--hellwal-gray-scale <float>` - Gray scale factor (default: 0.0)
|
||||||
|
|
||||||
|
**Matugen Generator**:
|
||||||
|
```bash
|
||||||
|
clrsync_cli --generate image.png --generator matugen --matugen-mode dark --matugen-contrast 0.5
|
||||||
|
```
|
||||||
|
|
||||||
|
Available matugen options:
|
||||||
|
- `--matugen-type <type>` - Color scheme type (default: "scheme-tonal-spot")
|
||||||
|
- `--matugen-mode <mode>` - Light or dark mode (default: "dark")
|
||||||
|
- `--matugen-contrast <float>` - Contrast value from -1 to 1 (default: 0.0)
|
||||||
|
|
||||||
|
#### All Options
|
||||||
|
|
||||||
|
```
|
||||||
|
-h, --help Show help message and exit
|
||||||
|
-v, --version Print version information and exit
|
||||||
|
-a, --apply Apply default theme
|
||||||
|
-c, --config Set config file path (default: ~/.config/clrsync/config.toml)
|
||||||
|
-l, --list-themes List available themes
|
||||||
|
-s, --show-vars Show color keys
|
||||||
|
-t, --theme Set theme <theme_name> to apply
|
||||||
|
-p, --path Set theme file <path/to/theme> to apply
|
||||||
|
-g, --generate Generate palette from <image path>
|
||||||
|
--generate-color Generate palette from a color (hex), used with --generator matugen
|
||||||
|
--generator Palette generator to use (default: "hellwal")
|
||||||
|
```
|
||||||
|
|
||||||
### GUI
|
### GUI
|
||||||
|
|
||||||
Launch the graphical editor:
|
Launch the graphical editor:
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
|||||||
return handle_apply_theme(program, default_theme);
|
return handle_apply_theme(program, default_theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (program.is_used("--generate"))
|
if (program.is_used("--generate") || program.is_used("--generate-color"))
|
||||||
{
|
{
|
||||||
std::string image_path;
|
std::string image_path;
|
||||||
if (program.is_used("--generate"))
|
if (program.is_used("--generate"))
|
||||||
@@ -190,6 +190,12 @@ int main(int argc, char *argv[])
|
|||||||
clrsync::core::palette pal;
|
clrsync::core::palette pal;
|
||||||
if (generator_name == "hellwal")
|
if (generator_name == "hellwal")
|
||||||
{
|
{
|
||||||
|
if (program.is_used("--generate-color"))
|
||||||
|
{
|
||||||
|
std::cerr << "Error: --generate-color is only supported with --generator matugen" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
clrsync::core::hellwal_generator gen;
|
clrsync::core::hellwal_generator gen;
|
||||||
clrsync::core::hellwal_generator::options opts{};
|
clrsync::core::hellwal_generator::options opts{};
|
||||||
|
|
||||||
@@ -289,8 +295,16 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (pal.name().empty())
|
if (pal.name().empty())
|
||||||
{
|
{
|
||||||
std::filesystem::path p(image_path);
|
if (program.is_used("--generate-color"))
|
||||||
pal.set_name("generated:" + p.filename().string());
|
{
|
||||||
|
std::string color = program.get<std::string>("--generate-color");
|
||||||
|
pal.set_name("generated:" + color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::filesystem::path p(image_path);
|
||||||
|
pal.set_name("generated:" + p.filename().string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dir = clrsync::core::config::instance().palettes_path();
|
auto dir = clrsync::core::config::instance().palettes_path();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace clrsync::core
|
namespace clrsync::core
|
||||||
{
|
{
|
||||||
|
|
||||||
const std::string GIT_SEMVER = "1.1.1+git.gb5f3507";
|
const std::string GIT_SEMVER = "1.1.1+git.g6badab9";
|
||||||
|
|
||||||
const std::string version_string();
|
const std::string version_string();
|
||||||
} // namespace clrsync::core
|
} // namespace clrsync::core
|
||||||
|
|||||||
Reference in New Issue
Block a user