Skip to content

Commit

Permalink
remove unqualified imports from gleam_community_colour
Browse files Browse the repository at this point in the history
  • Loading branch information
MAHcodes committed Apr 20, 2024
1 parent 2568c22 commit 1d0a427
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/catppuccin.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import gleam/int
import gleam/result
import gleam_community/colour.{type Colour, black}
import gleam_community/colour

pub type CatppuccinColor {
CatppuccinColor(
Expand All @@ -16,28 +16,28 @@ pub type CatppuccinColor {
/// falling back to black if an error occurs.
/// For more information, refer to the [`gleam_community_colour`](https://hexdocs.pm/gleam_community_colour/gleam_community/colour.html#Colour).
///
colour: Colour,
colour: colour.Colour,
/// The color result of the [`colour.from_rgb`](https://hexdocs.pm/gleam_community_colour/gleam_community/colour.html#from_rgb).
/// For more information, refer to the [`gleam_community_colour`](https://hexdocs.pm/gleam_community_colour/gleam_community/colour.html#Colour).
///
colour_result: Result(Colour, Nil),
colour_result: Result(colour.Colour, Nil),
)
}

/// Converts rgb values to a [`Colour`](https://hexdocs.pm/gleam_community_colour/gleam_community/colour.html).
/// returns [`black`](https://hexdocs.pm/gleam_community_colour/gleam_community/colour.html#black) as a fallback color, if the conversion fails.
/// It is utilized internally by the library and ideally should have been a private function.
///
pub fn to_colour(r r: Int, g g: Int, b b: Int) -> Colour {
pub fn to_colour(r r: Int, g g: Int, b b: Int) -> colour.Colour {
from_rgb(r: r, g: g, b: b)
|> result.unwrap(black)
|> result.unwrap(colour.black)
}

/// This is a wrapper for [`colour.from_rgb`](https://hexdocs.pm/gleam_community_colour/gleam_community/colour.html#from_rgb).
/// converting RGB values represented as Int to Float with the appropriate conversion.
/// It is utilized internally by the library and ideally should have been a private function.
///
pub fn from_rgb(r r: Int, g g: Int, b b: Int) -> Result(Colour, Nil) {
pub fn from_rgb(r r: Int, g g: Int, b b: Int) -> Result(colour.Colour, Nil) {
colour.from_rgb(
r: int.to_float(r) /. 255.0,
g: int.to_float(g) /. 255.0,
Expand Down

0 comments on commit 1d0a427

Please sign in to comment.