-
Notifications
You must be signed in to change notification settings - Fork 564
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
Question: Change stroke color of existing HanziWriter #87
Comments
There's currently not a method to do this, but it should be relatively easy to add. Just need to add a mutation in |
After taking a look at the options and given my use case I'm thinking that colouring the characters with CSS would actually be for the best - assuming it works in enough browsers (probably 'sorry IE users' kinda moment). Basically, I'm trying to have characters coloured according to tone, with users able to select their choice of tone colours from a set list of common colouring schemes/define their own and have them updated without a page refresh as part of a Vue-based 'single-page' app deely - similar to the Hanping dictionary. For anyone else who finds this, I think I've settled on something like the following using, the tone colors mentioned by Albert Wolfe. .tone-colors.tone-colors-dummit.color-char .char.t1 svg g g:nth-child(2) path {
stroke: #f41d2f;
} |
Using CSS like you described should work. I also went ahead and adding a PR to do this via a method on the |
|
Is there any way to change the color of a HanziWriter that already exists in the DOM without messing with its internal variables?
Looks like I could make it work by hacking on
hw._canvas.svg
/hw._renderState.state.character.main.strokeColor
, but that doesn't seem like a great idea 😈Alternatively, looks like I might be able to use CSS to colour the paths instead of relying on a JS way..
Not sure if there's a better way :)
The text was updated successfully, but these errors were encountered: