Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #10 Feature Request: Export formats of color codes #11

Merged
merged 6 commits into from
Feb 9, 2022

Conversation

git-thor
Copy link
Contributor

@git-thor git-thor commented Feb 7, 2022

Closes #10

This PR is targetting the Python implementation.

PR #11 Provides a helper function export(name, format) for exporting the colors to different formats EXPORT_FORMATS = {"HEX", "DEC", "REL", "XML", "IPE"}

Try with:

exported = export("Egypt", "dec")
    exported = export("Egypt", "rel")

    exported = export("Egypt", "xml")
    print(exported)
    for t in exported.get("tags"):
        print(t)

Decimal DEC

{'colors': [(221, 81, 41), (15, 122, 162), (66, 178, 131), (250, 178, 85)],
 'name': 'Egypt'}

Relative [0, 1] REL

{'colors': [(0.8666666666666667, 0.3176470588235297, 0.1607843137254903),
            (0.05882352941176472, 0.48235294117647026, 0.6352941176470588),
            (0.26274509803921564, 0.6980392156862745, 0.5176470588235293),
            (0.9803921568627451, 0.6980392156862747, 0.33333333333333337)],
 'name': 'Egypt'}

XML

{'colors': [(0.8666666666666667, 0.3176470588235297, 0.1607843137254903),
            (0.05882352941176472, 0.48235294117647026, 0.6352941176470588),
            (0.26274509803921564, 0.6980392156862745, 0.5176470588235293),
            (0.9803921568627451, 0.6980392156862747, 0.33333333333333337)],
 'name': 'Egypt',
 'tags': ['<color name="Egypt-1" value="0.8666666666666667 0.3176470588235297 '
          '0.1607843137254903" />',
          '<color name="Egypt-2" value="0.05882352941176472 '
          '0.48235294117647026 0.6352941176470588" />',
          '<color name="Egypt-3" value="0.26274509803921564 0.6980392156862745 '
          '0.5176470588235293" />',
          '<color name="Egypt-4" value="0.9803921568627451 0.6980392156862747 '
          '0.33333333333333337" />']}
<color name="Egypt-1" value="0.8666666666666667 0.3176470588235297 0.1607843137254903" />
<color name="Egypt-2" value="0.05882352941176472 0.48235294117647026 0.6352941176470588" />
<color name="Egypt-3" value="0.26274509803921564 0.6980392156862745 0.5176470588235293" />
<color name="Egypt-4" value="0.9803921568627451 0.6980392156862747 0.33333333333333337" />

@git-thor
Copy link
Contributor Author

git-thor commented Feb 7, 2022

This PR also resolves the broken README file due to missing code quote in the Python instruction.

@BlakeRMills BlakeRMills merged commit 0828353 into BlakeRMills:main Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Export formats of color codes
2 participants