Giter VIP home page Giter VIP logo

Comments (2)

krmanik avatar krmanik commented on June 16, 2024

The color is hard coded so may be in next update the it can be added to side bar menu till then change code of Card 5 in card templates.

// change color
var stroke_color = "#555";
var outline_color = "#DDD";
var drawing_color = "#333";
if (document.body.classList.contains("night_mode")) {
stroke_color = "#ffffff";
outline_color = "#5B5B5B";
drawing_color = "#fff";
}
function getToneColor(char) {
stroke_color = "#555";
if (document.body.classList.contains("night_mode")) {
stroke_color = "#ffffff";
}
switch (char) {
case "char-tone1": return "#f44336";
case "char-tone2": return "#ff9800";
case "char-tone3": return "#4caf50";
case "char-tone4": return "#2196f3";
case "char-tone0": return stroke_color;
case "char-tone5": return stroke_color;
}
}

from anki-xiehanzi.

camerooncameroon avatar camerooncameroon commented on June 16, 2024

@krmanik
This piece of code is equal to what I have in my local card templates (card # 5) so I assume you are just pointing out where exactly the code should be played with )

From what I see, we can set different colors depending on char's tone (including neutral) by editing hex codes - they appear when we successfully entered the hanzi or revealed it by tapping the button.
(That's really great enhancement by the way!)

IMHO:
I'm not really sure this control shall be included in the UI as usually these colors are set personally but once and forever.
So, editing template by hand won't be a hassle.
/end of IMHO )

Obviously, I put my suggestion incorrectly, what I meant was drawing color (the color which virtually 'comes out' from your stylus or fingertip when drawing the hanzi) - is it possible to make it tone dependent? So that when you draw 3rd tone hanzi - your lines will be colored as it's set for this tone.
Like currently the final appearance of the entered hanzi is (different color based on hanzi's tone).

The desired effect is such, that when you try to draw (even incorrectly), you already see the tone's corresponding color in your own writing and memorize the tone already (now these lines and curves are black in daymode and white in nightmode).

And when the hanzi is successfully entered, it also appears in the same "tone color", thus confirming the memorizing effect (the latter is already implemented).

PS. Also as I noted, the handwritten hanzi tone colors can't be currently varied depending on day/night mode?

PS2. in other words: is it possible to assign the resulting color from function getToneColor(char) not only to the stroke_color but also to the drawing_color?

from anki-xiehanzi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.