Skip to content

Commit 8b9f3c8

Browse files
committed
doc(palette.rs): Add document for a module
1 parent 8fe8c70 commit 8b9f3c8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/styles/palette.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1+
/// A module for creating palette color.
2+
///
3+
/// This module provides an struct `PaletteColor`
4+
/// that represents palette color, index should be between 0 to 255 mean u8.
5+
/// It also implements the `Stylify` trait for `PaletteColor`,
6+
/// which allows for generating styles based on the paint type.
7+
8+
// =======================================================================
9+
110
use super::{ paint_type::PaintType, Stylify };
211

312
// =======================================================================
413

14+
/// An struct representing index of palette color.
15+
///
16+
/// This struct has 1 field: `index`, which represent 8 bit color code between 0 to 255.
517
#[derive(Debug, Clone)]
618
pub struct PaletteColor {
719
pub index: u8,
820
}
921

1022
impl Stylify for PaletteColor {
23+
/// Returns a string representation of the palette index code.
24+
///
25+
/// If `paint_type` is `None`, the foreground color is assumed.
1126
fn make_styles(&self, paint_type: Option<&PaintType>) -> String {
1227
let paint_type = paint_type.unwrap_or(&PaintType::FG);
1328
format!(

0 commit comments

Comments
 (0)