Skip to main content

Appearance

Struct Appearance 

Source
#[non_exhaustive]
pub struct Appearance { pub theme: Theme, pub type_scale: TypeScale, pub chart: ChartStyle, }
Expand description

Full look. Default is compact 5×7 + dark high-readability theme.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§theme: Theme

Colors.

§type_scale: TypeScale

Glyph / cell metrics.

§chart: ChartStyle

Timeseries stroke/fill/ticks.

Implementations§

Source§

impl Appearance

Source

pub fn compact() -> Self

Compact 5×7 (same as Default).

Source

pub fn light() -> Self

Light page, dark text, compact glyphs.

Examples found in repository?
examples/gallery.rs (line 301)
241    fn build() -> Result<Self, sealed_surface::Error> {
242        let grid = demo_grid();
243        let series = demo_series()?;
244        let scatter = demo_scatter()?;
245        let tree = demo_tree()?;
246        let vp_table = Viewport::window(520, 220);
247        let vp_chart = Viewport::window(640, 280);
248        let mut specs = BTreeMap::new();
249        let mut add = |id, spec: Spec| {
250            specs.insert(id, spec);
251        };
252
253        add(
254            "table-default",
255            Spec {
256                title: "Table · default (compact)",
257                blurb: "TypeScale::Compact — 5×7, row 18. Hover for PNG tooltip.",
258                kind: Kind::Table,
259                appearance: Appearance::default(),
260                mode: SurfaceMode::Sealed,
261                lens: LicenseLens::open(),
262                viewport: vp_table,
263                caption: None,
264                widths: None,
265            },
266        );
267        add(
268            "table-large",
269            Spec {
270                title: "Table · large (2×)",
271                blurb: "TypeScale::large() — opt-in; bigger bitmap, more strain.",
272                kind: Kind::Table,
273                appearance: Appearance::large(),
274                mode: SurfaceMode::Sealed,
275                lens: LicenseLens::open(),
276                viewport: Viewport::window(640, 280),
277                caption: None,
278                widths: None,
279            },
280        );
281        add(
282            "table-xlarge",
283            Spec {
284                title: "Table · xlarge (3×)",
285                blurb: "TypeScale::xlarge().",
286                kind: Kind::Table,
287                appearance: Appearance::xlarge(),
288                mode: SurfaceMode::Sealed,
289                lens: LicenseLens::open(),
290                viewport: Viewport::window(720, 320),
291                caption: None,
292                widths: None,
293            },
294        );
295        add(
296            "table-light",
297            Spec {
298                title: "Table · light",
299                blurb: "Theme::light(), compact glyphs.",
300                kind: Kind::Table,
301                appearance: Appearance::light(),
302                mode: SurfaceMode::Sealed,
303                lens: LicenseLens::open(),
304                viewport: vp_table,
305                caption: None,
306                widths: None,
307            },
308        );
309        add(
310            "table-hc",
311            Spec {
312                title: "Table · high contrast",
313                blurb: "Near-white text, strong grid.",
314                kind: Kind::Table,
315                appearance: Appearance::high_contrast(),
316                mode: SurfaceMode::Sealed,
317                lens: LicenseLens::open(),
318                viewport: vp_table,
319                caption: None,
320                widths: None,
321            },
322        );
323
324        let mut tmp = Surface::new(SurfaceMode::Sealed, LicenseLens::open());
325        tmp.set_appearance(Appearance::default());
326        let m = tmp.metrics(&grid);
327        add(
328            "table-scroll",
329            Spec {
330                title: "Table · scroll_by",
331                blurb: "Sticky header; body scrolled three rows.",
332                kind: Kind::Table,
333                appearance: Appearance::default(),
334                mode: SurfaceMode::Sealed,
335                lens: LicenseLens::open(),
336                viewport: vp_table.scroll_by(0, (m.row_height * 3) as i32, &m),
337                caption: None,
338                widths: None,
339            },
340        );
341        add(
342            "table-resize",
343            Spec {
344                title: "Table · column resize",
345                blurb: "SKU column forced to 220px.",
346                kind: Kind::Table,
347                appearance: Appearance::default(),
348                mode: SurfaceMode::Sealed,
349                lens: LicenseLens::open(),
350                viewport: vp_table,
351                caption: None,
352                widths: Some(m.resize_column(0, 220)),
353            },
354        );
355        add(
356            "table-copyable",
357            Spec {
358                title: "Table · copyable",
359                blurb: "Same pixels; TSV allowed. Tooltip still PNG.",
360                kind: Kind::Table,
361                appearance: Appearance::default(),
362                mode: SurfaceMode::Copyable,
363                lens: LicenseLens::open(),
364                viewport: vp_table,
365                caption: None,
366                widths: None,
367            },
368        );
369        add(
370            "table-trial",
371            Spec {
372                title: "Table · trial lens",
373                blurb: "Two clear rows; rest redacted before paint.",
374                kind: Kind::Table,
375                appearance: Appearance::default(),
376                mode: SurfaceMode::Sealed,
377                lens: LicenseLens::from_tier(AccessTier::Trial),
378                viewport: vp_table,
379                caption: None,
380                widths: None,
381            },
382        );
383        add(
384            "ts-default",
385            Spec {
386                title: "Timeseries · default",
387                blurb: "AA 2px stroke, area fill, nice ticks. Hover the line.",
388                kind: Kind::Series,
389                appearance: Appearance::default(),
390                mode: SurfaceMode::Sealed,
391                lens: LicenseLens::open(),
392                viewport: vp_chart,
393                caption: Some("px / qty"),
394                widths: None,
395            },
396        );
397        add(
398            "ts-large",
399            Spec {
400                title: "Timeseries · large type",
401                blurb: "Same chart, 2× tick glyphs.",
402                kind: Kind::Series,
403                appearance: Appearance::large(),
404                mode: SurfaceMode::Sealed,
405                lens: LicenseLens::open(),
406                viewport: vp_chart,
407                caption: Some("large"),
408                widths: None,
409            },
410        );
411        add(
412            "ts-light",
413            Spec {
414                title: "Timeseries · light",
415                blurb: "Light theme + derived ChartStyle.",
416                kind: Kind::Series,
417                appearance: Appearance::light(),
418                mode: SurfaceMode::Sealed,
419                lens: LicenseLens::open(),
420                viewport: vp_chart,
421                caption: Some("light"),
422                widths: None,
423            },
424        );
425        add(
426            "ts-hc",
427            Spec {
428                title: "Timeseries · high contrast",
429                blurb: "Strong grid and series colors.",
430                kind: Kind::Series,
431                appearance: Appearance::high_contrast(),
432                mode: SurfaceMode::Sealed,
433                lens: LicenseLens::open(),
434                viewport: vp_chart,
435                caption: Some("HC"),
436                widths: None,
437            },
438        );
439        add(
440            "ts-trial",
441            Spec {
442                title: "Timeseries · trial lens",
443                blurb: "Two samples kept per series.",
444                kind: Kind::Series,
445                appearance: Appearance::default(),
446                mode: SurfaceMode::Sealed,
447                lens: LicenseLens::from_tier(AccessTier::Trial),
448                viewport: vp_chart,
449                caption: Some("trial"),
450                widths: None,
451            },
452        );
453        add(
454            "sc-default",
455            Spec {
456                title: "Scatter · default",
457                blurb: "Unconnected markers. Same Series type, different encoding.",
458                kind: Kind::Scatter,
459                appearance: Appearance::default(),
460                mode: SurfaceMode::Sealed,
461                lens: LicenseLens::open(),
462                viewport: vp_chart,
463                caption: Some("scatter"),
464                widths: None,
465            },
466        );
467        add(
468            "sc-trial",
469            Spec {
470                title: "Scatter · trial lens",
471                blurb: "Two points kept per series.",
472                kind: Kind::Scatter,
473                appearance: Appearance::default(),
474                mode: SurfaceMode::Sealed,
475                lens: LicenseLens::from_tier(AccessTier::Trial),
476                viewport: vp_chart,
477                caption: Some("trial"),
478                widths: None,
479            },
480        );
481        add(
482            "tm-default",
483            Spec {
484                title: "Treemap · default",
485                blurb: "Squarified leaves. Hover a cell for PNG tooltip.",
486                kind: Kind::Tree,
487                appearance: Appearance::default(),
488                mode: SurfaceMode::Sealed,
489                lens: LicenseLens::open(),
490                viewport: Viewport::window(640, 320),
491                caption: Some("catalog"),
492                widths: None,
493            },
494        );
495        add(
496            "tm-trial",
497            Spec {
498                title: "Treemap · trial lens",
499                blurb: "Two leaves kept; areas reflow.",
500                kind: Kind::Tree,
501                appearance: Appearance::default(),
502                mode: SurfaceMode::Sealed,
503                lens: LicenseLens::from_tier(AccessTier::Trial),
504                viewport: Viewport::window(640, 320),
505                caption: Some("trial"),
506                widths: None,
507            },
508        );
509        add(
510            "tm-light",
511            Spec {
512                title: "Treemap · light",
513                blurb: "Same layout, light theme.",
514                kind: Kind::Tree,
515                appearance: Appearance::light(),
516                mode: SurfaceMode::Sealed,
517                lens: LicenseLens::open(),
518                viewport: Viewport::window(640, 320),
519                caption: Some("light"),
520                widths: None,
521            },
522        );
523
524        Ok(Self {
525            grid,
526            series,
527            scatter,
528            tree,
529            specs,
530        })
531    }
Source

pub fn high_contrast() -> Self

Near-max contrast (dark), compact glyphs.

Examples found in repository?
examples/gallery.rs (line 315)
241    fn build() -> Result<Self, sealed_surface::Error> {
242        let grid = demo_grid();
243        let series = demo_series()?;
244        let scatter = demo_scatter()?;
245        let tree = demo_tree()?;
246        let vp_table = Viewport::window(520, 220);
247        let vp_chart = Viewport::window(640, 280);
248        let mut specs = BTreeMap::new();
249        let mut add = |id, spec: Spec| {
250            specs.insert(id, spec);
251        };
252
253        add(
254            "table-default",
255            Spec {
256                title: "Table · default (compact)",
257                blurb: "TypeScale::Compact — 5×7, row 18. Hover for PNG tooltip.",
258                kind: Kind::Table,
259                appearance: Appearance::default(),
260                mode: SurfaceMode::Sealed,
261                lens: LicenseLens::open(),
262                viewport: vp_table,
263                caption: None,
264                widths: None,
265            },
266        );
267        add(
268            "table-large",
269            Spec {
270                title: "Table · large (2×)",
271                blurb: "TypeScale::large() — opt-in; bigger bitmap, more strain.",
272                kind: Kind::Table,
273                appearance: Appearance::large(),
274                mode: SurfaceMode::Sealed,
275                lens: LicenseLens::open(),
276                viewport: Viewport::window(640, 280),
277                caption: None,
278                widths: None,
279            },
280        );
281        add(
282            "table-xlarge",
283            Spec {
284                title: "Table · xlarge (3×)",
285                blurb: "TypeScale::xlarge().",
286                kind: Kind::Table,
287                appearance: Appearance::xlarge(),
288                mode: SurfaceMode::Sealed,
289                lens: LicenseLens::open(),
290                viewport: Viewport::window(720, 320),
291                caption: None,
292                widths: None,
293            },
294        );
295        add(
296            "table-light",
297            Spec {
298                title: "Table · light",
299                blurb: "Theme::light(), compact glyphs.",
300                kind: Kind::Table,
301                appearance: Appearance::light(),
302                mode: SurfaceMode::Sealed,
303                lens: LicenseLens::open(),
304                viewport: vp_table,
305                caption: None,
306                widths: None,
307            },
308        );
309        add(
310            "table-hc",
311            Spec {
312                title: "Table · high contrast",
313                blurb: "Near-white text, strong grid.",
314                kind: Kind::Table,
315                appearance: Appearance::high_contrast(),
316                mode: SurfaceMode::Sealed,
317                lens: LicenseLens::open(),
318                viewport: vp_table,
319                caption: None,
320                widths: None,
321            },
322        );
323
324        let mut tmp = Surface::new(SurfaceMode::Sealed, LicenseLens::open());
325        tmp.set_appearance(Appearance::default());
326        let m = tmp.metrics(&grid);
327        add(
328            "table-scroll",
329            Spec {
330                title: "Table · scroll_by",
331                blurb: "Sticky header; body scrolled three rows.",
332                kind: Kind::Table,
333                appearance: Appearance::default(),
334                mode: SurfaceMode::Sealed,
335                lens: LicenseLens::open(),
336                viewport: vp_table.scroll_by(0, (m.row_height * 3) as i32, &m),
337                caption: None,
338                widths: None,
339            },
340        );
341        add(
342            "table-resize",
343            Spec {
344                title: "Table · column resize",
345                blurb: "SKU column forced to 220px.",
346                kind: Kind::Table,
347                appearance: Appearance::default(),
348                mode: SurfaceMode::Sealed,
349                lens: LicenseLens::open(),
350                viewport: vp_table,
351                caption: None,
352                widths: Some(m.resize_column(0, 220)),
353            },
354        );
355        add(
356            "table-copyable",
357            Spec {
358                title: "Table · copyable",
359                blurb: "Same pixels; TSV allowed. Tooltip still PNG.",
360                kind: Kind::Table,
361                appearance: Appearance::default(),
362                mode: SurfaceMode::Copyable,
363                lens: LicenseLens::open(),
364                viewport: vp_table,
365                caption: None,
366                widths: None,
367            },
368        );
369        add(
370            "table-trial",
371            Spec {
372                title: "Table · trial lens",
373                blurb: "Two clear rows; rest redacted before paint.",
374                kind: Kind::Table,
375                appearance: Appearance::default(),
376                mode: SurfaceMode::Sealed,
377                lens: LicenseLens::from_tier(AccessTier::Trial),
378                viewport: vp_table,
379                caption: None,
380                widths: None,
381            },
382        );
383        add(
384            "ts-default",
385            Spec {
386                title: "Timeseries · default",
387                blurb: "AA 2px stroke, area fill, nice ticks. Hover the line.",
388                kind: Kind::Series,
389                appearance: Appearance::default(),
390                mode: SurfaceMode::Sealed,
391                lens: LicenseLens::open(),
392                viewport: vp_chart,
393                caption: Some("px / qty"),
394                widths: None,
395            },
396        );
397        add(
398            "ts-large",
399            Spec {
400                title: "Timeseries · large type",
401                blurb: "Same chart, 2× tick glyphs.",
402                kind: Kind::Series,
403                appearance: Appearance::large(),
404                mode: SurfaceMode::Sealed,
405                lens: LicenseLens::open(),
406                viewport: vp_chart,
407                caption: Some("large"),
408                widths: None,
409            },
410        );
411        add(
412            "ts-light",
413            Spec {
414                title: "Timeseries · light",
415                blurb: "Light theme + derived ChartStyle.",
416                kind: Kind::Series,
417                appearance: Appearance::light(),
418                mode: SurfaceMode::Sealed,
419                lens: LicenseLens::open(),
420                viewport: vp_chart,
421                caption: Some("light"),
422                widths: None,
423            },
424        );
425        add(
426            "ts-hc",
427            Spec {
428                title: "Timeseries · high contrast",
429                blurb: "Strong grid and series colors.",
430                kind: Kind::Series,
431                appearance: Appearance::high_contrast(),
432                mode: SurfaceMode::Sealed,
433                lens: LicenseLens::open(),
434                viewport: vp_chart,
435                caption: Some("HC"),
436                widths: None,
437            },
438        );
439        add(
440            "ts-trial",
441            Spec {
442                title: "Timeseries · trial lens",
443                blurb: "Two samples kept per series.",
444                kind: Kind::Series,
445                appearance: Appearance::default(),
446                mode: SurfaceMode::Sealed,
447                lens: LicenseLens::from_tier(AccessTier::Trial),
448                viewport: vp_chart,
449                caption: Some("trial"),
450                widths: None,
451            },
452        );
453        add(
454            "sc-default",
455            Spec {
456                title: "Scatter · default",
457                blurb: "Unconnected markers. Same Series type, different encoding.",
458                kind: Kind::Scatter,
459                appearance: Appearance::default(),
460                mode: SurfaceMode::Sealed,
461                lens: LicenseLens::open(),
462                viewport: vp_chart,
463                caption: Some("scatter"),
464                widths: None,
465            },
466        );
467        add(
468            "sc-trial",
469            Spec {
470                title: "Scatter · trial lens",
471                blurb: "Two points kept per series.",
472                kind: Kind::Scatter,
473                appearance: Appearance::default(),
474                mode: SurfaceMode::Sealed,
475                lens: LicenseLens::from_tier(AccessTier::Trial),
476                viewport: vp_chart,
477                caption: Some("trial"),
478                widths: None,
479            },
480        );
481        add(
482            "tm-default",
483            Spec {
484                title: "Treemap · default",
485                blurb: "Squarified leaves. Hover a cell for PNG tooltip.",
486                kind: Kind::Tree,
487                appearance: Appearance::default(),
488                mode: SurfaceMode::Sealed,
489                lens: LicenseLens::open(),
490                viewport: Viewport::window(640, 320),
491                caption: Some("catalog"),
492                widths: None,
493            },
494        );
495        add(
496            "tm-trial",
497            Spec {
498                title: "Treemap · trial lens",
499                blurb: "Two leaves kept; areas reflow.",
500                kind: Kind::Tree,
501                appearance: Appearance::default(),
502                mode: SurfaceMode::Sealed,
503                lens: LicenseLens::from_tier(AccessTier::Trial),
504                viewport: Viewport::window(640, 320),
505                caption: Some("trial"),
506                widths: None,
507            },
508        );
509        add(
510            "tm-light",
511            Spec {
512                title: "Treemap · light",
513                blurb: "Same layout, light theme.",
514                kind: Kind::Tree,
515                appearance: Appearance::light(),
516                mode: SurfaceMode::Sealed,
517                lens: LicenseLens::open(),
518                viewport: Viewport::window(640, 320),
519                caption: Some("light"),
520                widths: None,
521            },
522        );
523
524        Ok(Self {
525            grid,
526            series,
527            scatter,
528            tree,
529            specs,
530        })
531    }
Source

pub fn large() -> Self

2× glyphs.

Examples found in repository?
examples/gallery.rs (line 273)
241    fn build() -> Result<Self, sealed_surface::Error> {
242        let grid = demo_grid();
243        let series = demo_series()?;
244        let scatter = demo_scatter()?;
245        let tree = demo_tree()?;
246        let vp_table = Viewport::window(520, 220);
247        let vp_chart = Viewport::window(640, 280);
248        let mut specs = BTreeMap::new();
249        let mut add = |id, spec: Spec| {
250            specs.insert(id, spec);
251        };
252
253        add(
254            "table-default",
255            Spec {
256                title: "Table · default (compact)",
257                blurb: "TypeScale::Compact — 5×7, row 18. Hover for PNG tooltip.",
258                kind: Kind::Table,
259                appearance: Appearance::default(),
260                mode: SurfaceMode::Sealed,
261                lens: LicenseLens::open(),
262                viewport: vp_table,
263                caption: None,
264                widths: None,
265            },
266        );
267        add(
268            "table-large",
269            Spec {
270                title: "Table · large (2×)",
271                blurb: "TypeScale::large() — opt-in; bigger bitmap, more strain.",
272                kind: Kind::Table,
273                appearance: Appearance::large(),
274                mode: SurfaceMode::Sealed,
275                lens: LicenseLens::open(),
276                viewport: Viewport::window(640, 280),
277                caption: None,
278                widths: None,
279            },
280        );
281        add(
282            "table-xlarge",
283            Spec {
284                title: "Table · xlarge (3×)",
285                blurb: "TypeScale::xlarge().",
286                kind: Kind::Table,
287                appearance: Appearance::xlarge(),
288                mode: SurfaceMode::Sealed,
289                lens: LicenseLens::open(),
290                viewport: Viewport::window(720, 320),
291                caption: None,
292                widths: None,
293            },
294        );
295        add(
296            "table-light",
297            Spec {
298                title: "Table · light",
299                blurb: "Theme::light(), compact glyphs.",
300                kind: Kind::Table,
301                appearance: Appearance::light(),
302                mode: SurfaceMode::Sealed,
303                lens: LicenseLens::open(),
304                viewport: vp_table,
305                caption: None,
306                widths: None,
307            },
308        );
309        add(
310            "table-hc",
311            Spec {
312                title: "Table · high contrast",
313                blurb: "Near-white text, strong grid.",
314                kind: Kind::Table,
315                appearance: Appearance::high_contrast(),
316                mode: SurfaceMode::Sealed,
317                lens: LicenseLens::open(),
318                viewport: vp_table,
319                caption: None,
320                widths: None,
321            },
322        );
323
324        let mut tmp = Surface::new(SurfaceMode::Sealed, LicenseLens::open());
325        tmp.set_appearance(Appearance::default());
326        let m = tmp.metrics(&grid);
327        add(
328            "table-scroll",
329            Spec {
330                title: "Table · scroll_by",
331                blurb: "Sticky header; body scrolled three rows.",
332                kind: Kind::Table,
333                appearance: Appearance::default(),
334                mode: SurfaceMode::Sealed,
335                lens: LicenseLens::open(),
336                viewport: vp_table.scroll_by(0, (m.row_height * 3) as i32, &m),
337                caption: None,
338                widths: None,
339            },
340        );
341        add(
342            "table-resize",
343            Spec {
344                title: "Table · column resize",
345                blurb: "SKU column forced to 220px.",
346                kind: Kind::Table,
347                appearance: Appearance::default(),
348                mode: SurfaceMode::Sealed,
349                lens: LicenseLens::open(),
350                viewport: vp_table,
351                caption: None,
352                widths: Some(m.resize_column(0, 220)),
353            },
354        );
355        add(
356            "table-copyable",
357            Spec {
358                title: "Table · copyable",
359                blurb: "Same pixels; TSV allowed. Tooltip still PNG.",
360                kind: Kind::Table,
361                appearance: Appearance::default(),
362                mode: SurfaceMode::Copyable,
363                lens: LicenseLens::open(),
364                viewport: vp_table,
365                caption: None,
366                widths: None,
367            },
368        );
369        add(
370            "table-trial",
371            Spec {
372                title: "Table · trial lens",
373                blurb: "Two clear rows; rest redacted before paint.",
374                kind: Kind::Table,
375                appearance: Appearance::default(),
376                mode: SurfaceMode::Sealed,
377                lens: LicenseLens::from_tier(AccessTier::Trial),
378                viewport: vp_table,
379                caption: None,
380                widths: None,
381            },
382        );
383        add(
384            "ts-default",
385            Spec {
386                title: "Timeseries · default",
387                blurb: "AA 2px stroke, area fill, nice ticks. Hover the line.",
388                kind: Kind::Series,
389                appearance: Appearance::default(),
390                mode: SurfaceMode::Sealed,
391                lens: LicenseLens::open(),
392                viewport: vp_chart,
393                caption: Some("px / qty"),
394                widths: None,
395            },
396        );
397        add(
398            "ts-large",
399            Spec {
400                title: "Timeseries · large type",
401                blurb: "Same chart, 2× tick glyphs.",
402                kind: Kind::Series,
403                appearance: Appearance::large(),
404                mode: SurfaceMode::Sealed,
405                lens: LicenseLens::open(),
406                viewport: vp_chart,
407                caption: Some("large"),
408                widths: None,
409            },
410        );
411        add(
412            "ts-light",
413            Spec {
414                title: "Timeseries · light",
415                blurb: "Light theme + derived ChartStyle.",
416                kind: Kind::Series,
417                appearance: Appearance::light(),
418                mode: SurfaceMode::Sealed,
419                lens: LicenseLens::open(),
420                viewport: vp_chart,
421                caption: Some("light"),
422                widths: None,
423            },
424        );
425        add(
426            "ts-hc",
427            Spec {
428                title: "Timeseries · high contrast",
429                blurb: "Strong grid and series colors.",
430                kind: Kind::Series,
431                appearance: Appearance::high_contrast(),
432                mode: SurfaceMode::Sealed,
433                lens: LicenseLens::open(),
434                viewport: vp_chart,
435                caption: Some("HC"),
436                widths: None,
437            },
438        );
439        add(
440            "ts-trial",
441            Spec {
442                title: "Timeseries · trial lens",
443                blurb: "Two samples kept per series.",
444                kind: Kind::Series,
445                appearance: Appearance::default(),
446                mode: SurfaceMode::Sealed,
447                lens: LicenseLens::from_tier(AccessTier::Trial),
448                viewport: vp_chart,
449                caption: Some("trial"),
450                widths: None,
451            },
452        );
453        add(
454            "sc-default",
455            Spec {
456                title: "Scatter · default",
457                blurb: "Unconnected markers. Same Series type, different encoding.",
458                kind: Kind::Scatter,
459                appearance: Appearance::default(),
460                mode: SurfaceMode::Sealed,
461                lens: LicenseLens::open(),
462                viewport: vp_chart,
463                caption: Some("scatter"),
464                widths: None,
465            },
466        );
467        add(
468            "sc-trial",
469            Spec {
470                title: "Scatter · trial lens",
471                blurb: "Two points kept per series.",
472                kind: Kind::Scatter,
473                appearance: Appearance::default(),
474                mode: SurfaceMode::Sealed,
475                lens: LicenseLens::from_tier(AccessTier::Trial),
476                viewport: vp_chart,
477                caption: Some("trial"),
478                widths: None,
479            },
480        );
481        add(
482            "tm-default",
483            Spec {
484                title: "Treemap · default",
485                blurb: "Squarified leaves. Hover a cell for PNG tooltip.",
486                kind: Kind::Tree,
487                appearance: Appearance::default(),
488                mode: SurfaceMode::Sealed,
489                lens: LicenseLens::open(),
490                viewport: Viewport::window(640, 320),
491                caption: Some("catalog"),
492                widths: None,
493            },
494        );
495        add(
496            "tm-trial",
497            Spec {
498                title: "Treemap · trial lens",
499                blurb: "Two leaves kept; areas reflow.",
500                kind: Kind::Tree,
501                appearance: Appearance::default(),
502                mode: SurfaceMode::Sealed,
503                lens: LicenseLens::from_tier(AccessTier::Trial),
504                viewport: Viewport::window(640, 320),
505                caption: Some("trial"),
506                widths: None,
507            },
508        );
509        add(
510            "tm-light",
511            Spec {
512                title: "Treemap · light",
513                blurb: "Same layout, light theme.",
514                kind: Kind::Tree,
515                appearance: Appearance::light(),
516                mode: SurfaceMode::Sealed,
517                lens: LicenseLens::open(),
518                viewport: Viewport::window(640, 320),
519                caption: Some("light"),
520                widths: None,
521            },
522        );
523
524        Ok(Self {
525            grid,
526            series,
527            scatter,
528            tree,
529            specs,
530        })
531    }
Source

pub fn xlarge() -> Self

3× glyphs.

Examples found in repository?
examples/gallery.rs (line 287)
241    fn build() -> Result<Self, sealed_surface::Error> {
242        let grid = demo_grid();
243        let series = demo_series()?;
244        let scatter = demo_scatter()?;
245        let tree = demo_tree()?;
246        let vp_table = Viewport::window(520, 220);
247        let vp_chart = Viewport::window(640, 280);
248        let mut specs = BTreeMap::new();
249        let mut add = |id, spec: Spec| {
250            specs.insert(id, spec);
251        };
252
253        add(
254            "table-default",
255            Spec {
256                title: "Table · default (compact)",
257                blurb: "TypeScale::Compact — 5×7, row 18. Hover for PNG tooltip.",
258                kind: Kind::Table,
259                appearance: Appearance::default(),
260                mode: SurfaceMode::Sealed,
261                lens: LicenseLens::open(),
262                viewport: vp_table,
263                caption: None,
264                widths: None,
265            },
266        );
267        add(
268            "table-large",
269            Spec {
270                title: "Table · large (2×)",
271                blurb: "TypeScale::large() — opt-in; bigger bitmap, more strain.",
272                kind: Kind::Table,
273                appearance: Appearance::large(),
274                mode: SurfaceMode::Sealed,
275                lens: LicenseLens::open(),
276                viewport: Viewport::window(640, 280),
277                caption: None,
278                widths: None,
279            },
280        );
281        add(
282            "table-xlarge",
283            Spec {
284                title: "Table · xlarge (3×)",
285                blurb: "TypeScale::xlarge().",
286                kind: Kind::Table,
287                appearance: Appearance::xlarge(),
288                mode: SurfaceMode::Sealed,
289                lens: LicenseLens::open(),
290                viewport: Viewport::window(720, 320),
291                caption: None,
292                widths: None,
293            },
294        );
295        add(
296            "table-light",
297            Spec {
298                title: "Table · light",
299                blurb: "Theme::light(), compact glyphs.",
300                kind: Kind::Table,
301                appearance: Appearance::light(),
302                mode: SurfaceMode::Sealed,
303                lens: LicenseLens::open(),
304                viewport: vp_table,
305                caption: None,
306                widths: None,
307            },
308        );
309        add(
310            "table-hc",
311            Spec {
312                title: "Table · high contrast",
313                blurb: "Near-white text, strong grid.",
314                kind: Kind::Table,
315                appearance: Appearance::high_contrast(),
316                mode: SurfaceMode::Sealed,
317                lens: LicenseLens::open(),
318                viewport: vp_table,
319                caption: None,
320                widths: None,
321            },
322        );
323
324        let mut tmp = Surface::new(SurfaceMode::Sealed, LicenseLens::open());
325        tmp.set_appearance(Appearance::default());
326        let m = tmp.metrics(&grid);
327        add(
328            "table-scroll",
329            Spec {
330                title: "Table · scroll_by",
331                blurb: "Sticky header; body scrolled three rows.",
332                kind: Kind::Table,
333                appearance: Appearance::default(),
334                mode: SurfaceMode::Sealed,
335                lens: LicenseLens::open(),
336                viewport: vp_table.scroll_by(0, (m.row_height * 3) as i32, &m),
337                caption: None,
338                widths: None,
339            },
340        );
341        add(
342            "table-resize",
343            Spec {
344                title: "Table · column resize",
345                blurb: "SKU column forced to 220px.",
346                kind: Kind::Table,
347                appearance: Appearance::default(),
348                mode: SurfaceMode::Sealed,
349                lens: LicenseLens::open(),
350                viewport: vp_table,
351                caption: None,
352                widths: Some(m.resize_column(0, 220)),
353            },
354        );
355        add(
356            "table-copyable",
357            Spec {
358                title: "Table · copyable",
359                blurb: "Same pixels; TSV allowed. Tooltip still PNG.",
360                kind: Kind::Table,
361                appearance: Appearance::default(),
362                mode: SurfaceMode::Copyable,
363                lens: LicenseLens::open(),
364                viewport: vp_table,
365                caption: None,
366                widths: None,
367            },
368        );
369        add(
370            "table-trial",
371            Spec {
372                title: "Table · trial lens",
373                blurb: "Two clear rows; rest redacted before paint.",
374                kind: Kind::Table,
375                appearance: Appearance::default(),
376                mode: SurfaceMode::Sealed,
377                lens: LicenseLens::from_tier(AccessTier::Trial),
378                viewport: vp_table,
379                caption: None,
380                widths: None,
381            },
382        );
383        add(
384            "ts-default",
385            Spec {
386                title: "Timeseries · default",
387                blurb: "AA 2px stroke, area fill, nice ticks. Hover the line.",
388                kind: Kind::Series,
389                appearance: Appearance::default(),
390                mode: SurfaceMode::Sealed,
391                lens: LicenseLens::open(),
392                viewport: vp_chart,
393                caption: Some("px / qty"),
394                widths: None,
395            },
396        );
397        add(
398            "ts-large",
399            Spec {
400                title: "Timeseries · large type",
401                blurb: "Same chart, 2× tick glyphs.",
402                kind: Kind::Series,
403                appearance: Appearance::large(),
404                mode: SurfaceMode::Sealed,
405                lens: LicenseLens::open(),
406                viewport: vp_chart,
407                caption: Some("large"),
408                widths: None,
409            },
410        );
411        add(
412            "ts-light",
413            Spec {
414                title: "Timeseries · light",
415                blurb: "Light theme + derived ChartStyle.",
416                kind: Kind::Series,
417                appearance: Appearance::light(),
418                mode: SurfaceMode::Sealed,
419                lens: LicenseLens::open(),
420                viewport: vp_chart,
421                caption: Some("light"),
422                widths: None,
423            },
424        );
425        add(
426            "ts-hc",
427            Spec {
428                title: "Timeseries · high contrast",
429                blurb: "Strong grid and series colors.",
430                kind: Kind::Series,
431                appearance: Appearance::high_contrast(),
432                mode: SurfaceMode::Sealed,
433                lens: LicenseLens::open(),
434                viewport: vp_chart,
435                caption: Some("HC"),
436                widths: None,
437            },
438        );
439        add(
440            "ts-trial",
441            Spec {
442                title: "Timeseries · trial lens",
443                blurb: "Two samples kept per series.",
444                kind: Kind::Series,
445                appearance: Appearance::default(),
446                mode: SurfaceMode::Sealed,
447                lens: LicenseLens::from_tier(AccessTier::Trial),
448                viewport: vp_chart,
449                caption: Some("trial"),
450                widths: None,
451            },
452        );
453        add(
454            "sc-default",
455            Spec {
456                title: "Scatter · default",
457                blurb: "Unconnected markers. Same Series type, different encoding.",
458                kind: Kind::Scatter,
459                appearance: Appearance::default(),
460                mode: SurfaceMode::Sealed,
461                lens: LicenseLens::open(),
462                viewport: vp_chart,
463                caption: Some("scatter"),
464                widths: None,
465            },
466        );
467        add(
468            "sc-trial",
469            Spec {
470                title: "Scatter · trial lens",
471                blurb: "Two points kept per series.",
472                kind: Kind::Scatter,
473                appearance: Appearance::default(),
474                mode: SurfaceMode::Sealed,
475                lens: LicenseLens::from_tier(AccessTier::Trial),
476                viewport: vp_chart,
477                caption: Some("trial"),
478                widths: None,
479            },
480        );
481        add(
482            "tm-default",
483            Spec {
484                title: "Treemap · default",
485                blurb: "Squarified leaves. Hover a cell for PNG tooltip.",
486                kind: Kind::Tree,
487                appearance: Appearance::default(),
488                mode: SurfaceMode::Sealed,
489                lens: LicenseLens::open(),
490                viewport: Viewport::window(640, 320),
491                caption: Some("catalog"),
492                widths: None,
493            },
494        );
495        add(
496            "tm-trial",
497            Spec {
498                title: "Treemap · trial lens",
499                blurb: "Two leaves kept; areas reflow.",
500                kind: Kind::Tree,
501                appearance: Appearance::default(),
502                mode: SurfaceMode::Sealed,
503                lens: LicenseLens::from_tier(AccessTier::Trial),
504                viewport: Viewport::window(640, 320),
505                caption: Some("trial"),
506                widths: None,
507            },
508        );
509        add(
510            "tm-light",
511            Spec {
512                title: "Treemap · light",
513                blurb: "Same layout, light theme.",
514                kind: Kind::Tree,
515                appearance: Appearance::light(),
516                mode: SurfaceMode::Sealed,
517                lens: LicenseLens::open(),
518                viewport: Viewport::window(640, 320),
519                caption: Some("light"),
520                widths: None,
521            },
522        );
523
524        Ok(Self {
525            grid,
526            series,
527            scatter,
528            tree,
529            specs,
530        })
531    }

Trait Implementations§

Source§

impl Clone for Appearance

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Appearance

Source§

impl Debug for Appearance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Appearance

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Appearance

Source§

impl PartialEq for Appearance

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Appearance

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.