Skip to content

Commit

Permalink
Add Color struct export to lib
Browse files Browse the repository at this point in the history
Version bump lib to 0.4.0
  • Loading branch information
JamyGolden committed Jun 15, 2024
1 parent 7ae2c77 commit 688217e
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Changed

- Use latest `tinted-builder` crate

## [0.6.0] - 2024-06-11

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tinted-builder-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ strip-ansi-escapes = "0.2.0"

[dependencies.tinted-builder]
path = "../tinted-builder"
version = "0.3.0"
version = "0.4.0"

[[bin]]
name = "tinted-builder-rust"
Expand Down
2 changes: 1 addition & 1 deletion tinted-builder-rust/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn build_cli() -> Command {
)
}

pub fn get_matches() -> ArgMatches {
pub(crate) fn get_matches() -> ArgMatches {
let styles = styling::Styles::styled()
.header(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
.usage(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
Expand Down
6 changes: 3 additions & 3 deletions tinted-builder-rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod cli;
mod operations {
pub mod build;
pub mod sync;
pub(crate) mod build;
pub(crate) mod sync;
}
mod utils;

Expand All @@ -12,7 +12,7 @@ use crate::cli::get_matches;

const REPO_NAME: &str = env!("CARGO_PKG_NAME");

pub fn replace_tilde_slash_with_home(path_str: &str) -> Result<PathBuf> {
pub(crate) fn replace_tilde_slash_with_home(path_str: &str) -> Result<PathBuf> {
let trimmed_path_str = path_str.trim();
if trimmed_path_str.starts_with("~/") {
match dirs::home_dir() {
Expand Down
2 changes: 1 addition & 1 deletion tinted-builder-rust/src/operations/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn git_diff(target_dir: &Path) -> Result<bool> {
}

/// Sync schemes repo; Install if it does not exist, otherwise update
pub fn sync(schemes_path: &Path) -> Result<()> {
pub(crate) fn sync(schemes_path: &Path) -> Result<()> {
if schemes_path.is_dir() {
let is_diff = git_diff(schemes_path)?;

Expand Down
2 changes: 1 addition & 1 deletion tinted-builder-rust/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::io::Write;
use std::path::Path;

#[allow(dead_code)]
pub fn write_to_file(path: &Path, contents: &str) -> Result<()> {
pub(crate) fn write_to_file(path: &Path, contents: &str) -> Result<()> {
if path.exists() {
remove_file(path).with_context(|| format!("Unable to remove file: {}", path.display()))?;
}
Expand Down
7 changes: 7 additions & 0 deletions tinted-builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.4.0 - 2024-06-15

## Added

- Add `Color` struct to public exports to allow users to construct a
`Scheme` themselves.

## 0.3.0 - 2024-06-11

## Changed
Expand Down
2 changes: 1 addition & 1 deletion tinted-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tinted-builder"
description = "A Tinted Theming template builder which uses yaml color schemes to generate theme files."
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tinted-builder/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub const REQUIRED_BASE16_PALETTE_KEYS: [&str; 16] = [
pub(crate) const REQUIRED_BASE16_PALETTE_KEYS: [&str; 16] = [
"base00", "base01", "base02", "base03", "base04", "base05", "base06", "base07", "base08",
"base09", "base0A", "base0B", "base0C", "base0D", "base0E", "base0F",
];
pub const REQUIRED_BASE24_PALETTE_KEYS: [&str; 24] = [
pub(crate) const REQUIRED_BASE24_PALETTE_KEYS: [&str; 24] = [
"base00", "base01", "base02", "base03", "base04", "base05", "base06", "base07", "base08",
"base09", "base0A", "base0B", "base0C", "base0D", "base0E", "base0F", "base10", "base11",
"base12", "base13", "base14", "base15", "base16", "base17",
Expand Down
2 changes: 1 addition & 1 deletion tinted-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ mod constants;
mod scheme;
mod template;

pub use scheme::Scheme;
pub use scheme::{Color, Scheme};
pub use template::Template;
19 changes: 10 additions & 9 deletions tinted-builder/src/scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ use serde::{Deserialize, Deserializer};
use std::collections::HashMap;

use crate::constants::{REQUIRED_BASE16_PALETTE_KEYS, REQUIRED_BASE24_PALETTE_KEYS};
use crate::scheme::color::Color;

pub use crate::scheme::color::Color;

#[derive(Deserialize)]
pub struct SchemeWrapper {
pub system: String,
pub name: String,
pub slug: Option<String>,
pub author: String,
pub description: Option<String>,
pub variant: Option<String>,
pub palette: HashMap<String, String>,
pub(crate) system: String,
pub(crate) name: String,
pub(crate) slug: Option<String>,
pub(crate) author: String,
pub(crate) description: Option<String>,
pub(crate) variant: Option<String>,
pub(crate) palette: HashMap<String, String>,
}

#[derive(Debug)]
Expand All @@ -29,7 +30,7 @@ pub struct Scheme {
pub palette: HashMap<String, Color>,
}

pub fn slugify(input: &str) -> String {
pub(crate) fn slugify(input: &str) -> String {
let char_map: HashMap<char, &str> = [
('á', "a"),
('à', "a"),
Expand Down
3 changes: 1 addition & 2 deletions tinted-builder/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ pub struct Template {
content: String,
}

#[allow(dead_code)]
pub fn write_to_file(path: &Path, contents: &str) -> Result<()> {
pub(crate) fn write_to_file(path: &Path, contents: &str) -> Result<()> {
if path.exists() {
remove_file(path).with_context(|| format!("Unable to remove file: {}", path.display()))?;
}
Expand Down

0 comments on commit 688217e

Please sign in to comment.