ryanraposo / codeui

Customize your color theme for VS Code.
https://marketplace.visualstudio.com/items?itemName=ryanraposo.codeui
MIT License
141 stars 2 forks source link

[Feature] Responsive Color Picker #48

Open ryanraposo opened 2 years ago

ryanraposo commented 2 years ago

Responsive Color Picker

The color picker in the Color view should automatically resize to fit the view.

48_current

Relevant Code

The 'Color' view in CodeUI is a Webview, which is no different than an ordinary webpage.

The HTML comes from a template literal:

https://github.com/ryanraposo/codeui/blob/fff58bb5f8cb6147e5db15d18f2a2a6eeb354fe4/src/color.ts#L65-L87

This is the JavaScript behind the view:

https://github.com/ryanraposo/codeui/blob/fff58bb5f8cb6147e5db15d18f2a2a6eeb354fe4/media/main.js#L5-L49

Currently, there is no CSS other than the stylesheet included with the color picker package:

https://github.com/ryanraposo/codeui/blob/2325927c357e0db5fe85b1f8bba66bfbd53c413e/media/lib/reinvented-color-wheel.css#L1-L42

Note: the package, reinvented-color-picker, is located in codeui/media alongside main.js (above). It is stored locally (not via npm) in the lib folder:

media
    └main.js
    └───lib
        └ reinvented-color-wheel.min.css
        └ reinvented-color-wheel.min.js

Solution

The solve for this issue could involve:

https://github.com/ryanraposo/codeui/blob/fff58bb5f8cb6147e5db15d18f2a2a6eeb354fe4/media/main.js#L36-L47

ryanraposo commented 2 years ago

The color picker is now centered in the view. See: #49

Thanks, @devXprite.