Git Product home page Git Product logo

compose-jetbrains-theme's Introduction

We are planning to migrate to JetBrains/jewel!

We are discussing with JetBrains officials about migrating this project to JetBrains/jewel. This will be the focus of our next work.

Track progress in this issue: JetBrains/jewel#28

JetBrains UI Kit for Compose Desktop

New JetBrains style controls and UI kits for Compose Desktop.

Classic JetBrains UI kit have been moved to here.

screenshot

Quick Start

Requirements

JetBrains Runtime

To get the best presentation across platforms, this library requires the application to run on JetBrains Runtime (JBR).

JetBrains Runtime is a modified version of the JetBrains JDK distribution, which is widely used across the JetBrains' IDEs such as IntelliJ, GoLand and others.

In this library we use the additional API provided by JetBrains Runtime to customise the title bar in Windows and macOS.

If the JBWindow component is not used, it can also be used without the JetBrains Runtime.

When using JBWindow in a non-JetBrains Runtime environment, a native title bar may additionally be displayed.

JBR-17 (corresponding to JDK 17) can be downloaded from the SDK page of IntelliJ.

Make sure that the project SDK and Gradle JVM are both JBR-17.

Project SDK settings

Gradle JVM settings

jdk.unsupported module

Most of the JetBrains Runtime APIs are private to JetBrains, and the class sun.misc.Unsafe is used to get access to these APIs.

You need to add the jdk.unsupported module to the compose dependency as in the following code to make it work.

You can also skip this step if you don't need to use the JBWindow component.

compose.desktop {
    application {
        nativeDistributions {
            modules("jdk.unsupported")
        }
    }
}

1. Add dependency

dependencies {
    implementation(compose.desktop.currentOs) {
        exclude("org.jetbrains.compose.material")
    }
    implementation("com.bybutter.compose:compose-jetbrains-expui-theme:2.0.0")
}

2. Use JBWindow DSL

The optimal display of JBWindow requires JetBrains Runtime, refer to the previous requirements.

fun main() = application {
    JBWindow(
        title = "JetBrains ExpUI Gallery",
        showTitle = true, // If you want to render your own component in the center of the title bar like Intellij do, disable this to hide the title of the MainToolBar (TitleBar).
        theme = LightTheme, // Change the theme here, LightTheme and DarkTheme are provided.
        state = rememberWindowState(size = DpSize(900.dp, 700.dp)),
        onCloseRequest = {
            exitApplication()
        },
        mainToolBar = {
            // Render your own component in the MainToolBar (TitleBar).
            Row(
                Modifier.mainToolBarItem(
                    Alignment.End,
                    true
                )
            ) { // Use the mainToolBarItem modifier to change alignment of components and enable/disable window drag area on this component.
            }
        }) {
        // Window content
    }
}

3. Use LightTheme and DarkTheme DSL

Since JBWindow requires JetBrains Runtime, if you don't want to use the JBWindow component, you can also use a normal Window with LightTheme/DarkTheme DSL.

fun main() = application {
    Window({}) {
        LightTheme {
            // Your components here
        }
    }
}

Screenshot

MacOS

截屏2022-11-21 17 11 56

截屏2022-11-21 17 12 18

Windows

image
image

Linux(Ubuntu with Gnome)

image image

compose-jetbrains-theme's People

Contributors

devkanro avatar github-actions[bot] avatar devsrsouza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.