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

avoid using "colour" module in Importing%20revealjs%20themes.ipynb #77

Open
jason-s opened this issue Jul 8, 2016 · 0 comments
Open

Comments

@jason-s
Copy link

jason-s commented Jul 8, 2016

The colour module doesn't appear to be part of the standard conda installation. Please consider rewriting the Importing%20revealjs%20themes.ipynb notebook not to use it. If you are only dealing with #abc and #aabbcc style RGB specs, you could just use a simple function like

c_re = re.compile('^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$')

def repeat_chars(s,k):
    return ''.join(c*k for c in s)

def v2color(v):
    m = c_re.search(v)
    if not m:
        return None
    rgb = m.group(1)
    if len(rgb) == 3:
        rgb = repeat_chars(rgb,2)
    return tuple(int(rgb[k:k+2],16) for k in xrange(0,6,2))
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

No branches or pull requests

1 participant