Skip to content

Commit

Permalink
Converted Color Picker Script to Proper Module (#7)
Browse files Browse the repository at this point in the history
* Added sample setup file

* Created the setup file

* Added a manifest file

* Fixed issues related to pip

* Fixed issues related to pathing

* Added documentation

* Changed image to URL

* Updated version given documentation
  • Loading branch information
jrg94 authored Dec 4, 2020
1 parent 1d2e12e commit 0bfea9e
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ celerybeat-schedule
.venv
env/
venv/
venv38/
ENV/
env.bak/
venv.bak/
Expand Down
7 changes: 5 additions & 2 deletions .idea/color-picker.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include color_picker/assets *
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# color-picker


The PSO2 color picker is a command line tool for generating the
PSO2 color palette given some RGB value. Currently, this is a toy
project that works as follows:

1. Install the color-picker tool: `pip install pso2-color-picker`
2. Execute the color-picker tool: `color-picker`
3. Follow the prompts
1. "Please provide file name (include .png)": [insert name of output file (e.g. nagatoro-hair.png)]
2. "Please enter a color as comma-separated RGB" [insert color (e.g. 123, 234, 12)]

If done correctly, a window should pop up with an image like the following:

![Sample Green](https://raw.githubusercontent.com/jrg94/color-picker/master/samples/tomo.png)

Likewise, a file will be saved at the location you ran the script with the
file name you provided in Step 3i.

Let us know if you like it! Given enough community support, we would be happy to
extend this tool to be more user-friendly.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
11 changes: 6 additions & 5 deletions color_picker/color_picker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Sequence

import numpy as np
Expand All @@ -7,11 +8,11 @@

GRADIENT_SIZE = (23, 197)

CAST_COLOR_IMAGE = "../assets/cast.png"
CAST_GRAY_IMAGE = '../assets/cast-grayscale.png'
SLIDER_IMAGE = '../assets/slider.png'
RETICLE_IMAGE = '../assets/reticle.png'
WINDOW_UI = '../assets/window_ui.png'
CAST_COLOR_IMAGE = os.path.join(os.path.dirname(__file__), "assets", "cast.png")
CAST_GRAY_IMAGE = os.path.join(os.path.dirname(__file__), 'assets', 'cast-grayscale.png')
SLIDER_IMAGE = os.path.join(os.path.dirname(__file__), 'assets', 'slider.png')
RETICLE_IMAGE = os.path.join(os.path.dirname(__file__), 'assets', 'reticle.png')
WINDOW_UI = os.path.join(os.path.dirname(__file__), 'assets', 'window_ui.png')


def color_diff(rgb_x: np.array, rgb_y: np.array) -> float:
Expand Down
Binary file removed color_picker/edge.png
Binary file not shown.
34 changes: 34 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="pso2-color-picker",
version="0.1.3",
author="The Renegade Coder",
author_email="jeremy.grifski@therenegadecoder.com",
description="A color matching tool for PSO2.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/jrg94/color-picker",
packages=setuptools.find_packages(),
include_package_data=True,
python_requires=">=3.8",
entry_points={
"console_scripts": [
'color-picker = color_picker.color_picker:main',
],
"gui_scripts": [
'image-titler-gui = imagetitler.gui:main',
]
},
classifiers=[
"Programming Language :: Python :: 3.8",
"Operating System :: OS Independent",
],
install_requires=[
'pillow>=6.0.0',
'numpy==1.19.3',
],
)

0 comments on commit 0bfea9e

Please sign in to comment.