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

Color mapping not supported #55

Open
Maestrop82 opened this issue Jun 29, 2020 · 0 comments
Open

Color mapping not supported #55

Maestrop82 opened this issue Jun 29, 2020 · 0 comments

Comments

@Maestrop82
Copy link

Maestrop82 commented Jun 29, 2020

In the current version, simple color mapping in an scss file is not supported.

Example:

$shadow-black:              rgba(black, 0.3);
$dark-on-20:    #bcc2cc;
background-hover-primary:      rgba($dark-on-20, 0.10),

Error message for black mapping:

ERROR:qtsass.api:Failed to compile source code
Traceback (most recent call last):
  File "...\Anaconda3\Scripts\qtsass-script.py", line 9, in <module>
    sys.exit(main())
  File "...\Anaconda3\lib\site-packages\qtsass\cli.py", line 72, in main
    compile_filename(args.input, args.output)
  File "...\Anaconda3\lib\site-packages\qtsass\api.py", line 120, in compile_filename
    css = compile(string, **kwargs)
  File "...\Anaconda3\lib\site-packages\qtsass\api.py", line 94, in compile
    return qt_conform(sass.compile(**kwargs))
  File "...\Anaconda3\lib\site-packages\sass.py", line 738, in compile
    raise CompileError(v)
sass.CompileError: Error: Function rgba is missing argument $b.
        on line 46 of stdin
>> $shadow-black-secondary:    rgba(black, 0.7);

Error message for color variable mapping:

ERROR:qtsass.api:Failed to compile source code
Traceback (most recent call last):
  File "...\Anaconda3\Scripts\qtsass-script.py", line 9, in <module>
    sys.exit(main())
  File "...\Anaconda3\lib\site-packages\qtsass\cli.py", line 72, in main
    compile_filename(args.input, args.output)
  File "...\Anaconda3\lib\site-packages\qtsass\api.py", line 120, in compile_filename
    css = compile(string, **kwargs)
  File "...\Anaconda3\lib\site-packages\qtsass\api.py", line 94, in compile
    return qt_conform(sass.compile(**kwargs))
  File "...\Anaconda3\lib\site-packages\sass.py", line 738, in compile
    raise CompileError(v)
sass.CompileError: Error: Function rgba is missing argument $b.
        on line 162 of stdin
>> background-hover-primary:   rgba($dark-on-20, 0.10),

   ----------------------------^

The code currently only supports the 4argument color input here:

class SassColor(collections.namedtuple('SassColor', ('r', 'g', 'b', 'a'))):

    def __new__(cls, r, g, b, a):
        r = float(r)
        g = float(g)
        b = float(b)
        a = float(a)
        return super(SassColor, cls).__new__(cls, r, g, b, a)
@dalthviz dalthviz added this to the v0.4.0 milestone Sep 5, 2022
@dalthviz dalthviz modified the milestones: v0.4.0, v0.4.1 Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants