// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
pub type Color

///|
pub(open) trait IColor {
  fn as_color(Self) -> Color
  fn parse(Self, String) -> Bool = _
  fn parse_with_alpha(Self, String) -> UInt? = _
  fn to_string(Self) -> String = _
}

///|
pub impl IColor for Color with fn as_color(self) {
  self
}

///|
#borrow(self_, spec)
extern "c" fn moonbit_pango_color_parse(self_ : Color, spec : Bytes) -> Bool = "moonbit_pango_color_parse"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Color.parse.html).
pub fn Color::parse(self : Color, spec : String) -> Bool {
  moonbit_pango_color_parse(self, @encoding/utf8.encode(spec))
}

///|
#borrow(self_, alpha, spec)
extern "c" fn moonbit_pango_color_parse_with_alpha(
  self_ : Color,
  alpha : Ref[UInt],
  spec : Bytes,
) -> Bool = "moonbit_pango_color_parse_with_alpha"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Color.parse_with_alpha.html).
pub fn Color::parse_with_alpha(self : Color, spec : String) -> UInt? {
  let alpha = Ref(0U)
  let result = moonbit_pango_color_parse_with_alpha(
    self,
    alpha,
    @encoding/utf8.encode(spec),
  )
  if result {
    Some(alpha.val)
  } else {
    None
  }
}

///|
#borrow(self_)
extern "c" fn moonbit_pango_color_to_string(self_ : Color) -> Bytes = "moonbit_pango_color_to_string"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Color.to_string.html).
pub fn Color::to_string(self : Color) -> String {
  @encoding/utf8.decode_lossy(moonbit_pango_color_to_string(self))
}

///|
impl IColor with fn parse(self, spec) -> Bool {
  self.as_color().parse(spec)
}

///|
impl IColor with fn parse_with_alpha(self, spec) -> UInt? {
  self.as_color().parse_with_alpha(spec)
}

///|
impl IColor with fn to_string(self) -> String {
  self.as_color().to_string()
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
#borrow(self_)
pub extern "c" fn Color::get_red(self_ : Color) -> UInt = "moonbit_pango_color_red_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
#borrow(self_)
pub extern "c" fn Color::set_red(self_ : Color, value : UInt) = "moonbit_pango_color_red_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
#borrow(self_)
pub extern "c" fn Color::get_green(self_ : Color) -> UInt = "moonbit_pango_color_green_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
#borrow(self_)
pub extern "c" fn Color::set_green(self_ : Color, value : UInt) = "moonbit_pango_color_green_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
#borrow(self_)
pub extern "c" fn Color::get_blue(self_ : Color) -> UInt = "moonbit_pango_color_blue_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Color.html).
#borrow(self_)
pub extern "c" fn Color::set_blue(self_ : Color, value : UInt) = "moonbit_pango_color_blue_set"

///|
pub extern "c" fn Color::_zero() -> Color = "moonbit_pango_color__zero"