sketch/media

Define media queries directly with functions. Refer to the sketch module to get more details on the usage.

Advanced usage

Media queries can be rather complex, and the module tries to give all features in a usable way. A media query takes form (property: value) and can be combined, like (orientation: landscape) or (min-width: 1000px). Those media queries can be created by using the corresponding and, or or not functions.

Types

pub opaque type ColorMode
pub opaque type Query

Functions

pub fn and(first: Query, second: Query) -> Query
pub fn dark_theme() -> Query
pub fn landscape() -> Query
pub fn light_theme() -> Query
pub fn max_height(size: Size) -> Query
pub fn max_width(size: Size) -> Query
pub fn min_height(size: Size) -> Query
pub fn min_width(size: Size) -> Query
pub fn not(query: Query) -> Query
pub fn or(first: Query, second: Query) -> Query
pub fn portrait() -> Query
pub fn to_string(query: Query) -> String

Internal function, can be used if you need to go from a media query to a String in case you’re building on top of sketch.

Search Document