Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Joe-noh/colorful
colorful is justice
https://github.com/Joe-noh/colorful
Last synced: about 1 month ago
JSON representation
colorful is justice
- Host: GitHub
- URL: https://github.com/Joe-noh/colorful
- Owner: Joe-noh
- License: mit
- Created: 2014-07-14T14:21:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-08T02:32:00.000Z (almost 10 years ago)
- Last Synced: 2024-10-12T01:41:34.793Z (2 months ago)
- Language: Elixir
- Homepage: https://hex.pm/packages/colorful
- Size: 359 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Elixir macros to decorate characters on CUI. (Text and Numbers)
- fucking-awesome-elixir - colorful - Elixir macros to decorate characters on CUI. (Text and Numbers)
- awesome-elixir - colorful - Elixir macros to decorate characters on CUI. (Text and Numbers)
README
# Colorful
## `Colorful`
```elixir
Colorful.string("hello", "red underline") #=> "\e[0m\e[31m\e[4mhello\e[0m"
Colorful.string("hello", ["red", "bright"]) #=> "\e[0m\e[31m\e[1mhello\e[0m"
Colorful.string("hello", [:red, :bright]) #=> "\e[0m\e[31m\e[1mhello\e[0m"Colorful.string("orange", {5, 2, 1})
Colorful.string("underlined orange", [:underline, {5, 2, 1}])Colorful.string("hello") #=> "\e[0mhello\e[0m"
Colorful.puts("hello", "red")
Colorful.inspect([1, 2], "blue white_background") # This returns [1, 2] like IO.inspectColorful.puts(:stderr, "hello", "red")
```## `Colorful.Color`
```elixir
Colorful.Color.from_name "air_force_blue"
#=> %Colorful.Color{blue: 168, brightness: 51.2, code: "#5d8aa8", green: 138,
# hue: 204.0, name: "air_force_blue", red: 93, saturation: 30.1}Colorful.Color.from_name("blue") = Colorful.Color.from_name(:blue)
Colorful.Color.names
# => ["air_force_blue", "alice_blue", "alizarin_crimson", ... ]
```