{"id":26611245,"url":"https://github.com/link2twenty/rust-color","last_synced_at":"2025-03-24T02:35:25.331Z","repository":{"id":283745609,"uuid":"952759234","full_name":"Link2Twenty/rust-color","owner":"Link2Twenty","description":"A simple colour manipulation program written in rust","archived":false,"fork":false,"pushed_at":"2025-03-21T22:14:25.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T23:23:27.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Link2Twenty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-21T20:40:49.000Z","updated_at":"2025-03-21T22:14:28.000Z","dependencies_parsed_at":"2025-03-21T23:23:29.414Z","dependency_job_id":"2f531127-c382-4868-8036-48148cd0175a","html_url":"https://github.com/Link2Twenty/rust-color","commit_stats":null,"previous_names":["link2twenty/rust-color"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link2Twenty%2Frust-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link2Twenty%2Frust-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link2Twenty%2Frust-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link2Twenty%2Frust-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Link2Twenty","download_url":"https://codeload.github.com/Link2Twenty/rust-color/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245199482,"owners_count":20576553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-24T02:35:24.410Z","updated_at":"2025-03-24T02:35:25.317Z","avatar_url":"https://github.com/Link2Twenty.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Colour Manipulation\n\nThis is a learning project written in Rust that explores colour manipulation techniques. The project demonstrates how to work with different colour formats (Hex, RGB, and HSL) and provides methods to manipulate and transform colours.\n\n## Features\n\nThe project includes the following features:\n\n### Colour Formats\n- **Hex**: A string representation of a colour in hexadecimal format (e.g., `#ff6347`).\n- **RGB**: A tuple of three integers representing red, green, and blue components (e.g., `(255, 99, 71)`).\n- **HSL**: A tuple of three values representing hue, saturation, and lightness (e.g., `(243, 1.0, 0.38)`).\n\n### Methods\n\n#### Conversion Methods\n- `to_rgb()`: Converts the colour to RGB format.\n- `to_hex()`: Converts the colour to Hex format.\n- `to_hsl()`: Converts the colour to HSL format.\n\n#### Combination Methods\n- `combine(other: \u0026Color, percentage: f32, colour_space: \u0026str)`: Combines two colours based on a percentage and a specified colour space (`RGB` or `HSL`).\n- `combine_rgb(other: \u0026Color, percentage: f32)`: Combines two colours in the RGB colour space.\n- `combine_hsl(other: \u0026Color, percentage: f32)`: Combines two colours in the HSL colour space.\n\n#### Manipulation Methods\n- `darken(percentage: f32)`: Darkens the colour by a given percentage.\n- `lighten(percentage: f32)`: Lightens the colour by a given percentage.\n- `saturate(percentage: f32)`: Increases the saturation of the colour by a given percentage.\n- `desaturate(percentage: f32)`: Decreases the saturation of the colour by a given percentage.\n- `grayscale()`: Converts the colour to grayscale by removing all saturation.\n- `hue_rotate(angle: u16)`: Rotates the hue of the colour by a given angle.\n- `invert()`: Inverts the colour by rotating the hue by 180 degrees.\n\n#### Utility Methods\n- `split()`: Splits the colour into its RGB components.\n- `print()`: Prints the colour in its current format to the console.\n\n## Example Usage\n\n```rust\nmod color;\nuse color::Color;\n\nfn main() {\n    let hex_tomato = Color::Hex(String::from(\"ff6347\")).to_rgb();\n    let darkened = hex_tomato.darken(0.2);\n    let lightened = hex_tomato.lighten(0.2);\n    let inverted = hex_tomato.invert();\n\n    hex_tomato.print();\n    darkened.print();\n    lightened.print();\n    inverted.print();\n}\n```\n\n## Purpose\n\nThis project is designed for learning purposes and serves as an introduction to Rust programming, enums, and method implementations. It also provides a practical example of working with colour formats and transformations.\n\nFeel free to explore and modify the code to deepen your understanding of Rust and colour manipulation techniques!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flink2twenty%2Frust-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flink2twenty%2Frust-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flink2twenty%2Frust-color/lists"}