Skip to content

Commit

Permalink
Documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ogeon committed Apr 4, 2020
1 parent 60089d9 commit 9084414
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions palette/src/alpha/mod.rs
Expand Up @@ -9,11 +9,11 @@ mod alpha;

/// A trait for color types that can have or be given transparency (alpha channel).
///
/// It's an interface for adding, removing and setting the transparency of a
/// color type. The type itself doesn't need to store the transparency
/// value, as long as it can be transformed into or wrapped in a type that
/// does have a representation of transparency. This would typically be done
/// by wrapping it in an [`Alpha`](struct.Alpha.html) instance.
/// `Transparency` is an interface for adding, removing and setting the alpha
/// channel of a color type. The color type itself doesn't need to store the
/// transparency value as it can be transformed into or wrapped in a type that
/// has a representation of transparency. This would typically be done by
/// wrapping it in an [`Alpha`](struct.Alpha.html) instance.
///
/// # Deriving
/// The trait is trivial enough to be automatically derived. If the color type
Expand Down Expand Up @@ -79,7 +79,7 @@ pub trait Transparency<A: Component>: Sized {
type WithAlpha: Transparency<A, Color = Self::Color, WithAlpha = Self::WithAlpha>;

/// Transforms the color into a transparent color with the provided
/// alpha value. If `Self` already has a transparency, that one is
/// alpha value. If `Self` already has a transparency, it is
/// overwritten.
///
/// ```
Expand All @@ -98,7 +98,7 @@ pub trait Transparency<A: Component>: Sized {
fn with_alpha(self, alpha: A) -> Self::WithAlpha;

/// Removes the transparency from the color. If `Self::Color` has
/// an internal transparency field, that one should be set to
/// an internal transparency field, that field will be set to
/// `A::max_intensity()` to make it opaque.
///
/// ```
Expand All @@ -112,11 +112,11 @@ pub trait Transparency<A: Component>: Sized {
/// ```
fn without_alpha(self) -> Self::Color;

/// Removes the color into separate color and transparency values.
/// Splits the color into separate color and transparency values.
///
/// A color without any transparency field should return
/// A color without any transparency field will return
/// `A::max_intensity()` instead. If `Self::Color` has an internal
/// transparency field, that one should be set to
/// transparency field, that field will be set to
/// `A::max_intensity()` to make it opaque.
///
/// ```
Expand All @@ -132,7 +132,7 @@ pub trait Transparency<A: Component>: Sized {
fn split(self) -> (Self::Color, A);

/// Transforms the color into a fully opaque color with a transparency
/// field. If `Self` already has a transparency, that one is overwritten.
/// field. If `Self` already has a transparency, it is overwritten.
///
/// ```
/// use palette::{Srgb, Srgba, Transparency};
Expand All @@ -147,7 +147,7 @@ pub trait Transparency<A: Component>: Sized {
}

/// Transforms the color into a fully transparent color. If `Self`
/// already has a transparency, that one is overwritten.
/// already has a transparency, it is overwritten.
///
/// ```
/// use palette::{Srgb, Srgba, Transparency};
Expand Down
24 changes: 12 additions & 12 deletions palette/src/convert.rs
Expand Up @@ -63,7 +63,7 @@
//! * `rgb_space = "some::rgb_space::Type"`: Sets the RGB space
//! type that should be used when deriving. The default is to either use `Srgb`
//! or a best effort to convert between spaces, so sometimes it has to be set
//! to a specific type. This does also accept type parameters.
//! to a specific type. This also accepts type parameters.
//!
//! ## Field Attributes
//!
Expand Down Expand Up @@ -313,9 +313,9 @@ impl<T> Display for OutOfBounds<T> {
///
/// See [`FromColor`](trait.FromColor.html) for more details.
pub trait IntoColor<T>: Sized {
///Convert into T with values clamped to the color defined bounds
/// Convert into T with values clamped to the color defined bounds
///
///```
/// ```
/// use palette::{Lch, Srgb, Limited, IntoColor};
///
/// let rgb: Srgb = Lch::new(50.0, 100.0, -175.0).into_color();
Expand All @@ -330,9 +330,9 @@ pub trait IntoColor<T>: Sized {
///
/// See [`FromColorUnclamped`](trait.FromColorUnclamped.html) for more details.
pub trait IntoColorUnclamped<T>: Sized {
///Convert into T. The resulting color might be invalid in its color space
/// Convert into T. The resulting color might be invalid in its color space
///
///```
/// ```
/// use palette::convert::IntoColorUnclamped;
/// use palette::{Lch, Srgb, Limited};
///
Expand Down Expand Up @@ -371,7 +371,7 @@ pub trait TryIntoColor<T>: Sized {
///
/// `U: FromColor<T>` is implemented for every type `U: FromColorUnclamped<T> + Limited`.
///
/// See [`FromColorUnclamped`](trait.FromColorUnclamped.html) for a non-lossy version of this trait.
/// See [`FromColorUnclamped`](trait.FromColorUnclamped.html) for a lossless version of this trait.
/// See [`TryFromColor`](trait.TryFromColor.html) for a trait that gives an error when the result
/// is out of bounds.
///
Expand All @@ -388,14 +388,14 @@ pub trait TryIntoColor<T>: Sized {
/// such as allowing implementing `FromColor<Rgb<S2, T>> for Rgb<S1, T>`.
/// * Implementing `FromColorUnclamped` and `Limited` is enough to get all the other conversion
/// traits, while `From` and `Into` would not be possible to blanket implement in the same way.
/// This does also reduce the work that need to be done by macros.
/// This also reduces the work that needs to be done by macros.
///
/// See the [`convert`](index.html) module for how to implement `FromColorUnclamped` for
/// custom colors.
pub trait FromColor<T>: Sized {
///Convert from T with values clamped to the color defined bounds.
/// Convert from T with values clamped to the color defined bounds.
///
///```
/// ```
/// use palette::{Lch, Srgb, Limited, FromColor};
///
/// let rgb = Srgb::from_color(Lch::new(50.0, 100.0, -175.0));
Expand All @@ -413,9 +413,9 @@ pub trait FromColor<T>: Sized {
/// See the [`convert`](index.html) module for how to implement `FromColorUnclamped` for
/// custom colors.
pub trait FromColorUnclamped<T>: Sized {
///Convert from T. The resulting color might be invalid in its color space.
/// Convert from T. The resulting color might be invalid in its color space.
///
///```
/// ```
/// use palette::convert::FromColorUnclamped;
/// use palette::{Lch, Srgb, Limited};
///
Expand All @@ -430,7 +430,7 @@ pub trait FromColorUnclamped<T>: Sized {
/// `U: TryFromColor<T>` is implemented for every type `U: FromColorUnclamped<T> + Limited`.
///
/// See [`FromColor`](trait.FromColor.html) for a lossy version of this trait.
/// See [`FromColorUnclamped`](trait.FromColorUnclamped.html) for a non-lossy version.
/// See [`FromColorUnclamped`](trait.FromColorUnclamped.html) for a lossless version.
///
/// See the [`convert`](index.html) module for how to implement `FromColorUnclamped` for
/// custom colors.
Expand Down

0 comments on commit 9084414

Please sign in to comment.