MCPcopy Create free account
hub / github.com/GCWing/BitFun / apply_opencode_theme_json

Method apply_opencode_theme_json

src/apps/cli/src/ui/theme.rs:463–508  ·  view source on GitHub ↗
(
        &self,
        json: &OpencodeThemeJson,
        appearance: Appearance,
    )

Source from the content-addressed store, hash-verified

461 }
462
463 pub fn apply_opencode_theme_json(
464 &self,
465 json: &OpencodeThemeJson,
466 appearance: Appearance,
467 ) -> anyhow::Result<Self> {
468 let fallback = self.clone();
469 let resolved = resolve_opencode_theme(json, appearance)?;
470 Ok(Theme {
471 primary: resolved.primary.unwrap_or(fallback.primary),
472 success: resolved.success.unwrap_or(fallback.success),
473 warning: resolved.warning.unwrap_or(fallback.warning),
474 error: resolved.error.unwrap_or(fallback.error),
475 info: resolved.info.unwrap_or(fallback.info),
476 muted: resolved.muted.unwrap_or(fallback.muted),
477 background: resolved.background.unwrap_or(fallback.background),
478 border: resolved.border.unwrap_or(fallback.border),
479 background_panel: resolved
480 .background_panel
481 .unwrap_or(fallback.background_panel),
482 background_element: resolved
483 .background_element
484 .unwrap_or(fallback.background_element),
485 input_background: resolved.input_background.unwrap_or(
486 resolved
487 .background_element
488 .unwrap_or(fallback.input_background),
489 ),
490 diff_added_fg: resolved.diff_added_fg.unwrap_or(fallback.diff_added_fg),
491 diff_removed_fg: resolved.diff_removed_fg.unwrap_or(fallback.diff_removed_fg),
492 diff_added_bg: resolved.diff_added_bg.unwrap_or(fallback.diff_added_bg),
493 diff_removed_bg: resolved.diff_removed_bg.unwrap_or(fallback.diff_removed_bg),
494 block_bg: resolved.block_bg.unwrap_or(fallback.block_bg),
495 block_bg_hover: resolved.block_bg_hover.unwrap_or(fallback.block_bg_hover),
496 block_border_active: resolved
497 .block_border_active
498 .unwrap_or(fallback.block_border_active),
499 inline_icon: resolved.inline_icon.unwrap_or(fallback.inline_icon),
500 command_text: resolved.command_text.unwrap_or(fallback.command_text),
501 diff_hunk_header: resolved
502 .diff_hunk_header
503 .unwrap_or(fallback.diff_hunk_header),
504 diff_line_number: resolved
505 .diff_line_number
506 .unwrap_or(fallback.diff_line_number),
507 })
508 }
509
510 pub fn style(&self, kind: StyleKind) -> Style {
511 match kind {

Callers 5

newMethod · 0.80
resolve_theme_by_idMethod · 0.80
resolve_theme_by_idMethod · 0.80

Calls 2

resolve_opencode_themeFunction · 0.85
cloneMethod · 0.45