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

Colour constants are inconsistent with popular naming schemes #197

Closed
r0the opened this Issue May 8, 2018 · 2 comments

Comments

2 participants
@r0the
Contributor

r0the commented May 8, 2018

Bug Report

Actual behavior

The Arcade colour constants are confusing. Some are X11 colour names, some are CSS colour names, some are on the Wikipedia List of Colours, some are neither. Examples:

RGB Wikipedia X11 Name CSS Name Arcade Name
(240,230,140) Khaki (CSS) Light Khaki Khaki LIGHT_KHAKI
(195,176,145) Khaki (X11) Khaki KHAKI
(191,255,0) ? LIME
(0,255,0) Lime (Web) (X11 green) Green lime GREEN
(0,128,0) Green (HTML/CSS color) green OFFICE_GREEN
(240,255,255) Azure mist Azure azure AZURE_MIST
(0,127,255) Azure AZURE
(102,221,170) ? Medium aquamarine MEDIUM_AQUAMARINE
(102,205,170) Medium aquamarine mediumaquamarine

Expected behavior:

All colour names adhere to the same naming scheme. Personally, I'd prefer the SVG/CSS3 Color Names which my students already know from a web design course. I think the SVG list list would be enough, the current list is quite abundant.

Steps to reproduce/example code:

Run the following Python script to generate a HTML page showing the RGB colours as well as the colours of the corresponding CSS colour names:

import arcade

def load_arcade_colour_dict():
    file = open(arcade.color.__file__)
    result = {}
    for line in file:
        parts = line.replace('\n', '').replace(' ', '').split('=')
        if len(parts) == 2:
            colour = 'rgb' + parts[1]
            name = parts[0]
            result[name] = colour

    file.close()
    return result

def export_html(dict):
    file = open('colours.html', mode='w')
    file.write('<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n')
    file.write('<title>Arcade Colour Names</title>\n</head>\n')
    file.write('<body>\n<h1>Arcade Colour Names</h1>\n')
    file.write('<table width="100%"><tr><th>Arcade Name</th><th width="45%">RGB</th><th width="45%">CSS Name</th></tr>\n')
    for k in dict:
        file.write('<tr><td><code>arcade.color.' + k + '</code></td>')
        file.write('<td style="background: ' + dict[k] + ';"></td>')
        file.write('<td style="background: ' + k.replace('_', '') + ';"></td></tr>\n')
    file.write('</table>\n</body>\n</html>')
    file.close()

def main():
    dict = load_arcade_colour_dict()
    export_html(dict)
    
main()

@pvcraven pvcraven added the enhancement label May 8, 2018

@pvcraven

This comment has been minimized.

Owner

pvcraven commented May 8, 2018

The color list comes from here:

https://www.webpagefx.com/web-design/color-picker/color-chart/

Particularly for a library set up for learning, matching CSS colors would be a good idea. This would be rather simple to do. We could create another file like this:

https://github.com/pvcraven/arcade/blob/master/arcade/color/__init__.py

but put it in csscolor or use some other name. That way backwards compatibility is maintained.

@pvcraven pvcraven added this to the 1.3.4 milestone May 15, 2018

@pvcraven pvcraven added this to Done in Release 1.3.4 May 18, 2018

@pvcraven

This comment has been minimized.

Owner

pvcraven commented May 28, 2018

Closed with release of 1.3.4 on 28-May-2018.

@pvcraven pvcraven closed this May 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment