Skip to content

zTrap/compose-color-preview-plugin

Repository files navigation

Plugin version

Preview Compose color preview plugin for JetBrains IDE family

This plugin draws colors in the editor gutter and the code completion popup. You can modify them by clicking on the icons in the gutter

It works with the androidx.compose.ui.graphics.Color from Jetpack Compose or Compose Multiplatform

Features

  • Shows preview in the code completion popup for simple constant fields
  • Shows preview in places simple constant fields usage with type Color
  • Shows preview for results of compositeOver, copy, convert and lerp functions
  • Shows preview in the Color creation places
    • ULong constructor
    • Long "constructor" function
    • Int "constructor" function
    • Int x3 "constructor" function
    • Float x3 "constructor" function
    • Float x3 with color scheme "constructor" function
    • Float x4 "constructor" function
    • Float x4 with color scheme "constructor" function
    • hsl "constructor" function
    • hsv "constructor" function
  • Shows palette by clicking on the icon to change color
    • Change color with saving the original numeral system

Preview1 Preview2

Installation

Install it from the Jetbrains plugin repository within your IDE (recommended):

  • Settings/Preferences > Plugins > Marketplace > Search 'Compose Color Preview'

You can also download the JAR package from the Jetbrains plugin repository or from GitHub Releases and add it manually to your plugins:

  • Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

FAQ

I have a duplicate preview in the color declaration line in Android Studio. How to fix it?
You can simply disable one of the previews. Go to Settings/Preferences > Editor > General > Gutter Icons and disable "Compose color picker" from "Jetpack compose" section or "Color chooser" from "Compose Color Preview" section

Starting from IDEA 2024.1 colors list order in popup is reversed. Can you fix it?
Unfortunately, no. It's Intellij IDEA Platform bug and the issue is created. So we can only wait for a fix from JetBrains

Hex in color picker have wrong pattern. Can you fix it?
Yes, but it requires a complete rewrite of the color picker popup which is not what I want to do. A request for this feature has been submitted to JetBrains, and we need to wait for a reaction

Contribution

Contributions are welcome. Please check CONTRIBUTING.md for more information.

Besides source code contributions, feel free to open bug reports or just suggest new features here.

License

Copyright 2023-2024 Peter Gulko (zTrap)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.