pub struct Theme { /* private fields */ }Expand description
A color theme.
A color theme is a container with ThemeEntry::COUNT colors, one each for
the 16 ANSI colors as well as the default foreground and background colors
(in that order). The public interface is a compromise between struct and
array, a straurray if you will, to make the primary use case, processing the
colors in a theme, safer than when using numeric indices. Hence, you index a
color theme with semantic values, i.e., ThemeEntry, Layer, or
AnsiColor. At the same time, you can still access the underlying array
storage through AsRef<[Color]> for Theme, albeit
Rust-only and read-only.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new color theme with ThemeEntry::COUNT times the default color.
Sourcepub const fn with_array(colors: [Color; 18]) -> Self
pub const fn with_array(colors: [Color; 18]) -> Self
Create a new color theme with the given colors.
Sourcepub fn with_slice(colors: &[Color]) -> Option<Self>
pub fn with_slice(colors: &[Color]) -> Option<Self>
Create a new color theme with the given colors.
The given slice must have length ThemeEntry::COUNT. Otherwise, this
method returns None.
Source§impl Theme
impl Theme
Sourcepub const fn py_with_array(inner: [Color; 18]) -> Self
pub const fn py_with_array(inner: [Color; 18]) -> Self
Create a new color theme with the given colors.
Sourcepub fn __getitem__(&self, index: ThemeEntry) -> Color
pub fn __getitem__(&self, index: ThemeEntry) -> Color
Get the color for the given theme entry.
Sourcepub fn __setitem__(&mut self, index: ThemeEntry, value: Color)
pub fn __setitem__(&mut self, index: ThemeEntry, value: Color)
Set the color for the given theme entry.
pub fn __repr__(&self) -> String
Trait Implementations§
Source§impl Index<ThemeEntry> for Theme
impl Index<ThemeEntry> for Theme
Source§impl IndexMut<ThemeEntry> for Theme
impl IndexMut<ThemeEntry> for Theme
Source§impl<'py> IntoPyObject<'py> for Theme
impl<'py> IntoPyObject<'py> for Theme
Source§impl PyClassImpl for Theme
impl PyClassImpl for Theme
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"A color theme.\n\nA color theme is a container with [`ThemeEntry::COUNT`] colors, one each for\nthe 16 ANSI colors as well as the default foreground and background colors\n(in that order). The public interface is a compromise between struct and\narray, a straurray if you will, to make the primary use case, processing the\ncolors in a theme, safer than when using numeric indices. Hence, you index a\ncolor theme with semantic values, i.e., [`ThemeEntry`], [`Layer`], or\n[`AnsiColor`]. At the same time, you can still access the underlying array\nstorage through [`AsRef<[Color]> for\nTheme`](struct.Theme.html#impl-AsRef%3C%5BColor%5D%3E-for-Theme), albeit\nRust-only and read-only.\x00"
const RAW_DOC: &'static CStr = c"A color theme.\n\nA color theme is a container with [`ThemeEntry::COUNT`] colors, one each for\nthe 16 ANSI colors as well as the default foreground and background colors\n(in that order). The public interface is a compromise between struct and\narray, a straurray if you will, to make the primary use case, processing the\ncolors in a theme, safer than when using numeric indices. Hence, you index a\ncolor theme with semantic values, i.e., [`ThemeEntry`], [`Layer`], or\n[`AnsiColor`]. At the same time, you can still access the underlying array\nstorage through [`AsRef<[Color]> for\nTheme`](struct.Theme.html#impl-AsRef%3C%5BColor%5D%3E-for-Theme), albeit\nRust-only and read-only.\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<Theme>
type ThreadChecker = SendablePyClass<Theme>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyMethods<Theme> for PyClassImplCollector<Theme>
impl PyMethods<Theme> for PyClassImplCollector<Theme>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for Theme
impl PyTypeInfo for Theme
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for Theme
impl Eq for Theme
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnwindSafe for Theme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
§fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
§fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more