跳到正文
cccskills
免费在 GitHub 公开中文介绍

jewel-ui

使用 Jewel 主题和组件构建桌面 Compose 界面,涵盖插件或独立应用的主题选择、控件与图标,并将 IntelliJ Platform 逻辑放在组合函数之外。

原文查看原文说明

Build UI with Jewel components and themes.

JetBrains/intellij-community星标 20,684(GitHub 20,684 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 用 Jewel 构建桌面界面
  • 为插件或独立应用选择主题
  • 为页面挑选控件和图标

中文介绍

功能

本技能介绍如何使用 Jewel 的主题、组件、布局、图标和字体排版来实现 Compose 界面。首先区分运行环境是 IntelliJ 插件还是独立的 Compose Desktop 应用,再选择相应的主题包装器:SwingBridgeTheme 或 IntUiTheme。技能说明如何根据交互用途选择按钮、选项和输入框等组件,以及如何从主题中获取颜色和尺寸。内容还包括图标加载、自定义主题,以及将界面拆分成较小的组合函数。IntelliJ Platform 的状态和服务应放在组合函数之外:将状态传入界面,并通过回调返回事件。

适用场景

构建 IntelliJ 风格的桌面界面、为插件或独立应用选择主题设置,或确认某个页面适合使用哪些 Jewel 组件和图标时,可以使用本技能。

使用示例

  • “请用 Jewel 主题和按钮构建一个独立应用页面。”
  • “为 IntelliJ 插件中的 Compose 界面选择合适的主题。”
  • “请为这个设置页面推荐合适的 Jewel 输入组件。”

注意事项

Jewel 要实现完整的字体和绘制效果,需要 JetBrains Runtime。Compose 与 Swing 的嵌入机制不在本技能范围内。主要涉及配置 ToolWindow 或 ComposePanel 时,应使用 jewel-swing-interop。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好资料明确要求在组合函数之外访问 IntelliJ Platform API。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足插件与独立应用的依赖不同,且需要 JetBrains Runtime。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月28日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(12)

  • SKILL.md13.2 KB
  • evals/evals.json2.3 KB
  • references/COMPONENT-SELECTION.md12.8 KB
  • references/COMPONENTS-CATALOG.md5.4 KB
  • references/ICONS.md3.8 KB
  • references/LABEL-RULES.md3.0 KB
  • references/LAYOUT-PATTERNS.md3.6 KB
  • references/STANDALONE-VS-BRIDGE.md2.1 KB
  • references/THEMING-COLORS.md3.5 KB
  • references/THEMING.md2.7 KB
  • references/TYPOGRAPHY.md3.4 KB
  • skill-source.json1.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/jewel-ui/SKILL.md -->

Jewel UI

Implement UI with Jewel by first selecting the runtime context, then applying the correct theme wrapper, then using Jewel components and icon APIs.

Quick Snippets

Standalone:

IntUiTheme(isDark = false) {
    App()
}

IntelliJ plugin:

SwingBridgeTheme {
    App()
}

Icon loading:

object MyIcons {
    val Settings = PathIconKey("icons/settings.svg", MyIcons::class.java)
}

Icon(key = MyIcons.Settings, contentDescription = "Settings")

Decorated window (standalone, custom title bar):

IntUiTheme(
    theme = themeDefinition,
    styling = ComponentStyling.default().decoratedWindow(
        titleBarStyle = TitleBarStyle.light(),
    ),
) {
    DecoratedWindow(onCloseRequest = ::exitApplication) {
        TitleBar { /* title bar content */ }
        App()
    }
}

Customize the title bar (colors, metrics, and fullscreen-control handling) by passing TitleBarStyle to ComponentStyling.default().decoratedWindow(...), not through IntUiTheme(isDark = ...) alone.

Scope Boundary

This skill covers Jewel's theme wrappers, components, layout, icons, and typography — the Compose side of the UI. It does not cover Compose-in-Swing embedding mechanics. If the user's question is primarily about:

  • Registering ToolWindowFactory / ToolWindow content
  • Instantiating ComposePanel or wiring setContent
  • plugin.xml tool window extensions
  • enableNewSwingCompositing and related compositing/AWT flags
  • LocalComponent and Swing ↔ Compose bidirectional integration

…the correct response is to name jewel-swing-interop explicitly as the skill for that work and stop. Do not walk through ToolWindowFactory / ComposePanel / plugin.xml setup here, even if you know how. You can still state that content inside the ComposePanel must use SwingBridgeTheme (a theming concern, in scope), and defer the rest to jewel-swing-interop.

Classify Runtime Context

Decide runtime before writing code:

  1. IntelliJ Platform plugin: use the Swing bridge (SwingBridgeTheme) and IntelliJ bundled modules.
  2. Standalone Compose Desktop app: use IntUiTheme and standalone Jewel dependencies.

For agent-generated desktop UI prototypes, prefer a Jewel/desktop preview or sandbox when one is available. Choose Material-style mobile previews only deliberately for mobile/Android-targeting prototypes or when the user explicitly wants a mobile device-frame preview; Material styling is not the general desktop default.

If context is unclear, inspect build files and imports first:

  • org.jetbrains.jewel.bridge.theme.SwingBridgeTheme implies plugin context.
  • org.jetbrains.jewel.intui.standalone.theme.IntUiTheme implies standalone context.

Use STANDALONE-VS-BRIDGE.md for dependency and wrapper snippets.

Keep IntelliJ Platform APIs Out Of Composition

Do not leak or access IntelliJ Platform APIs (IJPL) directly or indirectly inside Jewel/Compose composition. Composables must render explicit state and emit events; IntelliJ Platform interaction belongs at the presenter, controller, service, or action boundary.

Avoid calling or indirectly reaching from composition into platform services, application state, registry, action system, project model, PSI, VFS, message bus, disposables, or other platform-owned mutable/thread-bound APIs. This protects recomposition stability, preview/test isolation, and compatibility across IntelliJ Platform updates.

Preferred pattern:

  1. Platform boundary reads/writes IntelliJ state and owns threading/lifecycle concerns.
  2. The boundary maps that platform state into stable UI state for the composable.
  3. Composable renders the state and invokes callbacks.
  4. Boundary handles callbacks and performs platform work outside composition.

If direct or indirect platform access from composition is unavoidable, pass an injected collaborator as a parameter or composition-local dependency that tests can replace with a fake. Keep the collaborator surface minimal and exclude platform objects from stable UI state. Manage threading, read/write actions, disposables, and Compose stability explicitly.

Apply Theming Correctly

Use the simplest valid theme API first:

  1. Standalone quick start: IntUiTheme(isDark = ...).
  2. For advanced standalone configuration, call IntUiTheme(theme = ..., styling = ..., swingCompatMode = ...).
  3. IntelliJ plugin: SwingBridgeTheme { ... }.

When implementing custom standalone themes:

  1. Build ThemeDefinition via JewelTheme.lightThemeDefinition(...) or JewelTheme.darkThemeDefinition(...).
  2. Override text styles using JewelTheme.createDefaultTextStyle() and JewelTheme.createEditorTextStyle().
  3. Pass composed styling through ComponentStyling.default().with(...) (or specialized style builders).
  4. Prefer public API packages; avoid internal/experimental APIs unless explicitly required.

Use THEMING.md for concrete patterns. Use THEMING-COLORS.md for color-palette and semantic-color guidance. Use TYPOGRAPHY.md for text-style guidance and when-to-use rules.

Key Theme-Derived Caches By Theme State

Do not key remember only by JewelTheme.name, a LaF name, or another human-readable label when the cached value is derived from theme data. Colours, metrics, typography, icon data, and Swing defaults can change while the visible theme name stays the same.

Prefer the narrowest correct key:

  1. If the calculation is cheap, skip remember.
  2. If the cached value depends on concrete values, key by those concrete values, such as colours, text styles, metrics, shortcut text, or strings.
  3. If the cached value depends on broad Jewel theme or LaF environment state that is not practical to enumerate, key by JewelTheme.instanceUuid.

Use JewelTheme.instanceUuid as an invalidation token for theme-instance changes, not as a blanket replacement for precise keys. Avoid JewelTheme.name as a proxy for theme state.

Pick the Right Component

Before writing component code, check COMPONENT-SELECTION.md for the when-to-use rule. Jewel implements the JetBrains IntelliJ Platform UI Guidelines — those guidelines constrain which control fits a given interaction, not just which APIs exist.

Most common decisions:

  1. Mutually exclusive pick from 2–4 options → RadioButtonRow under a GroupHeader (label ends with :). Do not use three DefaultButtons.
  2. For multi-select of independent boolean options, use a group of CheckboxRow controls, and use ThreeStateCheckbox for a "select all" parent.
  3. Pick from 5+ options, long labels, or less-frequent setting → ListComboBox / ComboBox.
  4. Use DefaultButton for the primary action in a form or dialog and OutlinedButton for secondary or cancel actions. Never place two DefaultButton controls side by side.
  5. Icon-only buttons → wrap in a Tooltip carrying the action name + keyboard shortcut. Every icon-only control needs one.
  6. Text input → TextField for one-line; TextArea for multi-line / newline-valid content (commit messages, descriptions, code).

Use COMPONENT-SELECTION.md for the full decision tables and LABEL-RULES.md for label-writing conventions.

Build UI With Jewel Components

Use Jewel components from org.jetbrains.jewel.ui.component for IntelliJ-styled UI.

  1. Use Compose layout containers (Row, Column, Box) for composition.
  2. Use Jewel controls (DefaultButton, OutlinedButton, TextField, Checkbox, Tabs, etc.) for interactive primitives.
  3. Access colors and metrics through Jewel theme locals and component styling APIs instead of hardcoded values.

Use local samples as source-of-truth examples:

Use LAYOUT-PATTERNS.md for composition archetypes extracted from those sample apps. Use COMPONENTS-CATALOG.md for component-by-component catalog guidance.

Keep Composables Small And Navigable

Treat composables like any other production code: keep them clean, clear, and as small as practical. Avoid huge composables with deep nesting and mixed responsibilities. Extract sub-composables when a branch, section, row, toolbar, footer, popup, or repeated layout block has a distinct purpose.

Organize files so readers can follow the UI top-down: put public entry-point composables near the top, then the private sub-composables they call in usage order. Keep helper functions, constants, and state-holder glue close to the code that uses them unless project conventions say otherwise.

Reusable composables are APIs. Give public or cross-file reusable composables KDoc that states their purpose, key parameters, slot expectations, and any non-obvious behavior. For high-level API design, use the AndroidX Compose guidance as a reference, adapted for Desktop/Jewel rather than Android-only APIs:

Do not copy those guidelines wholesale into this skill; link to the source so the guidance stays current.

Load Icons The Jewel Way

Use IconKey-based loading for portability across standalone and bridge:

  1. Use PathIconKey(path, iconClass) when icon path is the same across old/new UI.
  2. Use IntelliJIconKey(oldUiPath, newUiPath, iconClass) when paths differ.
  3. Use Icon(key = ..., contentDescription = ...) or Image(iconKey = ...) instead of deprecated raw painterResource.
  4. Use AllIconsKeys for IntelliJ platform icons.

When using AllIconsKeys in standalone apps, make sure IntelliJ icons are on the classpath (recommended: com.jetbrains.intellij.platform:icons).

Use PainterHint only when you need stateful or dynamic paths or runtime icon patching behavior.

When debugging icon-not-found errors, confirm runtime context (standalone vs plugin) before recommending a fix — AllIconsKeys availability and classpath layout differ between the two. Ask the user if context is not clear from the question.

Use ICONS.md for icon patterns and pitfalls.

Source Permalinks

When citing source in responses, prefer master links for always-latest behavior:

Version Discipline

Treat this skill as Jewel-version scoped.

  1. When version matters, check build files (libs.versions.toml, build.gradle.kts) first; ask only if ambiguous.
  2. Validate compatibility against Jewel release notes.
  3. Prefer APIs available in the target version; avoid suggesting newer APIs without stating the minimum version.
  4. If publishing a version-pinned variant of this skill, replace master links with release-tag links.

Implementation Checklist

Before finishing:

  1. Confirm context-specific theme wrapper is correct (IntUiTheme vs SwingBridgeTheme).
  2. Confirm icon code uses IconKey and classpath-friendly resource resolution.
  3. Confirm dependencies match context.
  4. Confirm no unnecessary Material dependency is introduced in standalone flows.
  5. Confirm code compiles with current module and imports.
  6. Confirm composables do not directly or indirectly access IntelliJ Platform APIs; platform interaction stays at the presenter/controller boundary or behind a tiny injected fakeable collaborator.
  7. Confirm large or deeply nested composables are split into clear sub-composables, file order follows top-down usage, and reusable composables have useful KDoc.
  8. Confirm theme-derived remember values are either uncached, keyed by the concrete values they use, or keyed by JewelTheme.instanceUuid when broad theme/LaF state is the dependency; do not key them by JewelTheme.name alone.
  9. For standalone apps, confirm JetBrains Runtime is used (Jewel requires JBR for full font/rendering behavior).

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

actions

免费有简介

实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。

  • 为 IDE 菜单添加操作
  • 修改操作注册或图标
  • 整理操作名称和说明
JetBrains/intellij-community2.1万2026年10月29日 更新

bazel-test-migration

免费有简介

将 IntelliJ JPS 测试模块迁移到 Bazel,并排查仅在 Bazel 中出现的失败。根据症状检查依赖、插件、测试数据和 runfiles,重新生成并验证目标。

  • 将 JPS 测试模块迁移到 Bazel
  • 排查仅在 Bazel 中失败的测试
  • 检查测试依赖和数据配置
JetBrains/intellij-community2.1万2026年10月29日 更新

code-style

免费有简介

按 IntelliJ 项目规范编写或审查 Kotlin 和 Java 代码,涵盖语言选择、格式、密封类型、线程注解及控制流异常处理。

  • 按 IntelliJ 规范编写 Kotlin
  • 审查 Java 代码
  • 检查异常处理和密封类型分支
JetBrains/intellij-community2.1万2026年10月29日 更新

commits

免费有简介

本指南帮助您按 IntelliJ 项目规则拆分更改并撰写提交信息:有工单时使用编号和变更说明,无工单时使用标签与子系统名,并在需要时说明原因和决定。

  • 按项目格式编写带工单号的提交信息
  • 整理测试或文档提交并选择合适标签
  • 按规则修改已有提交信息
JetBrains/intellij-community2.1万2026年10月29日 更新

使用多个 Python 类型检查器比较代码片段或文件的类型推断和报错判断,并汇总各工具的结论、耗时与诊断信息,可保存为 Markdown 报告。

  • 比较不同检查器的类型推断
  • 确认代码是否会被判为类型错误
  • 查看多个工具的诊断差异
JetBrains/intellij-community2.1万2026年10月29日 更新

整理 Compose Desktop 界面中的状态和副作用,让可组合函数负责绘制,由展示器或协调器处理应用决策。了解状态归属、Effect、可复用组件接口、延迟列表键、动画和性能,适用于单项界面修改。

  • 分离界面绘制与展示器决策
  • 整理界面状态的归属
  • 检查 Effect 键和协程用法
JetBrains/intellij-community2.1万2026年10月29日 更新

查看 JetBrains 的全部技能

报告此技能的问题