
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
palettecleanse is a python library for quick conversions of images to custom color palettes
palettecleanse
is a python library for quick conversions of images to custom color palettes
pip import palettecleanse
For manually installing requirements:
pip install -r requirements.txt
To verify the installation worked, run the following code:
from palettecleanse.presets import TwilightSunset
TwilightSunset.display_plotly_examples()
To convert an image to a custom color palette, simply select an image and load it into palettecleanse
as a Palette
object, where desired attributes such as the number of colors (n_colors
) can be specified as part of the class initialization. All available palettes for the image can be displayed via. the display_all_palettes
method.
from palettecleanse.palettes import Palette
# load image
vangogh = Palette('images/vangogh.jpg')
vangogh.display_all_palettes()
Specific palette types (sequential, qualitative, etc) are stored as attributes for this object and are compatible with matplotlib
, seaborn
, and plotly
.
# sequential palette in matplotlib
plt.scatter(x, y, c=colors, palette=vangogh.sequential)
# qualitative palette in matplotlib
plt.bar(categories, values, color=vangogh.qualitative)
# qualitative palette in seaborn
sns.swarmplot(df, x="x", y="y", hue="z", palette=vangogh.qualitative)
# generic palette in plotly
px.scatter(df, x="x", y="y", color="z", color_continuous_scale=vangogh.plotly)
To get a sense for how well your palette works, use the display_example_plots
method
# this creates some misc plots using your generated palettes
vangogh.display_example_plots()
# plotly equivalent
vangogh.display_plotly_examples()
palettecleanse
also comes prepackaged with some preset palettes:
from palettecleanse.presets import TwilightSunset
TwilightSunset.display_all_palettes()
See usage.ipynb
for more examples.
All available preset palettes can be accessed via. the display_all_preset_palettes
method
display_all_preset_palettes('sequential')
Below are example plots made using via. the display_example_plots
method that can be used to get a bird's eye view on how well a palette behaves across generic plot types
More examples available in usage.ipynb
.
Contributions at all levels are welcome! I'm happy to discuss with anyone the potential for contributions. Please see CONTRIBUTING.md
for some general guidelines and message me with any questions!
Jiaming Chen – jiaming.justin.chen@gmail.com
Distributed under the MIT license. See LICENSE.txt
for more information.
FAQs
palettecleanse is a python library for quick conversions of images to custom color palettes
We found that palettecleanse demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.