1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use super::{Color, Range};

/// Represents a color range from a document.
#[derive(Debug, Serialize)]
pub struct ColorInformation {
    /// The range in the document where this color appers.
    pub range: Range,

    /// The actual color value for this color range.
    pub color: Color,
}

/// The ColorInformation namespace provides helper functions to work with
/// [ColorInformation](#ColorInformation) literals.
impl ColorInformation {
    /// Creates a new ColorInformation literal.
    pub fn create(range: Range, color: Color) -> Self {
        ColorInformation {
            range,
            color,
        }
    }
}