-
Notifications
You must be signed in to change notification settings - Fork 964
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
Feature Request | Possibility request for adding a particular word different color in text class #111
Comments
Hi @hiren3897 - that is something that I am sure we would all love. As far as I know, it is a limitation of text on the canvas. In ZIM (powered by CreateJS) we have a class that breaks words up into their letters and then coloring certain ones would be possible - for example: https://zimjs.com/createjs/textcolor.html. Others may have better answers. Also... this request is in the TweenJS Library and you probably want the EaselJS Library. We can most likely answer it here though. Cheers. |
Hi Dan, do you mind me asking a few questions? When you break up the letters, do you then draw them as bitmap or as SVG? Also, I'm still having trouble with text resolution. Your text looks clear irrespective of window size; is that something that is handled in the Frame class or in the LabelLetters class? |
Thank you for your help this is what I want exactly. |
Sorry folks - missed the messages on this. @owendwyer ZIM has a Label class that is a Container that holds the CreateJS Text object. When we do LabelLetters it is making a Label from each - so a bunch of CreateJS Text objects as vectors (unless cached). The crispness is coming from ZIM Retina which is just accommodating the devicePixelRatio. That is the cause for all that /stage.width stuff messing up CreateJS mouse position, etc. on Adobe export. We have adjusted for that with our version of CreateJS and hope to address it in the master one day. @hiren3897 - you could look directly at the LabelLetters code and probably use it yourself - it is not too difficult - here is it - there are some ZIM specific things but perhaps you can get the gist of it. Or - go to the ZIM Docs at https://zimjs.com/docs.html and search for labelletters then press VIEW at the bottom of the entry to see the whole thing. btw... in the next version of ZIM we are providing basic html to be used in the text for a LabelLetters and then parsing that to render color, font, size, underline, italic, bold etc. based on this request and others we have had. Cheers.
|
I am trying to add color to a single word in the whole text that the user inputs in the Text class. text attribute
but it changes the color of the whole text sentence and I am not finding any possible way to do that
Is it possible to change the color of a particular word in the whole text sentence?
Example: "Welcome to ADVR world" in this sentence inputted by the user I want to add a different color to "ADVR" and rest should be set to white color
I tried this setting props in .set({color: 'red', text: 'ADVR'}) method but it removes the other text and adds only ADVR with red color
I want the whole sentence in white and only ADVR in red.
Is it possible to do that
If Yes, please it would be a great help to me
Thank you in advance.
@gskinner
The text was updated successfully, but these errors were encountered: