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

Read custom properties #34

Closed
yuanchuan opened this issue Sep 16, 2018 · 2 comments
Closed

Read custom properties #34

yuanchuan opened this issue Sep 16, 2018 · 2 comments

Comments

@yuanchuan
Copy link
Member

yuanchuan commented Sep 16, 2018

Example

<css-doodle>
  --colors: red, blue, green;

  /* Suppose there's @get() */
  color: @pick(@get(--colors));

   /* or better? */
  colors: @pick(--colors);
</css-doodle>

Function name

Need to introduce a new function name since @var has been taken already.

Related

#33, #30

@yuanchuan
Copy link
Member Author

yuanchuan commented Feb 12, 2019

I'm happy to find there's another usage for custom properties via use attribute:

<style>
  css-doodle {
    /* palette */
    --colors: red, blue, green;

    --rule: (
      background-color: @p(var(--colors));
      border-color: @pn(var(--colors));
    );
  }
</style>

<css-doodle use="var(--rule)"></css-doodle>

@yuanchuan
Copy link
Member Author

yuanchuan commented Feb 12, 2019

Or write css-doodle function inside custom properties:

<style>
  css-doodle {
    /* it's like defining a function */
    --color: @p(#e4fffe, #a4f6f9, #ff99fe, #ba52ed);

    --rule: (
      /* call the function */
      background: var(--color);

      /* call the function */
      border: 2vmin solid var(--color);
    );
  }
</style>

<css-doodle use="var(--rule)"></css-doodle>

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

1 participant