<p>This is not possible with existing products. You'd need a special input method, like <a href="https://play.google.com/store/apps/details?id=com.klye.ime.latin&amp;hl=en" rel="nofollow noreferrer">the Multiling Keyboard</a>, that would specifically format the input. There are a few difficulties with this:</p>

<ul>
<li>Many hanzi have multiple tones. Which one to pick? To be (possibly, but never 100%) accurate, you'd need a dictionary. Which means the input method would have to backtrack when the tone of the first character changes tone.</li>
<li>WeChat doesn't allow colour formatting. So your new input method won't be able to colour the text anyway.</li>
</ul>

<p>In WeChat's web interface, one might be able to develop a Chrome extension that reads all messages, and colours them. That wouldn't be <strong><em>that</em></strong> hard, but I expect it would be time consuming, and resource hungry.</p>

<p>EDIT</p>

<p>After giving it some thought, here is what I think would required:</p>

<ul>
<li>The <a href="https://www.mdbg.net/chindict/chindict.php?page=cc-cedict" rel="nofollow noreferrer">CEDICT</a> dictionary. Probably edited to fit a database.</li>
<li>Alternatively, if you only care about character tones, a database based on <a href="http://unicode.org/charts/unihan.html" rel="nofollow noreferrer">Unihan</a>.</li>
<li>Some Javascript and jQuery to lookup the messages and color them.</li>
</ul>

<p>Something like this [I am using Cantonese tones as I am much more comfortable with them]:</p>

<p><a href="https://i.sstatic.net/OfxYx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OfxYx.png" alt="enter image description here"></a></p>

<p>VERY COARSE CODE</p>

<pre><code>var db={};
db["行"]=4;
db["有"]=5;
db["人"]=4;
db["嗎"]=3;

var myColors= new Array("nil", "#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#00FFFF", "#FF00FF");

for (n in x) {
  myString="";
  if(x.hasOwnProperty(n)) {
    if(x[n].innerText!=undefined) {
      s=x[n].innerText;
      console.log(n, s);
      j=s.length;
      for(i=0; i&lt;j; i++) {
        z=s.charAt(i);
        t=myColors[db[z]];
        console.log(" .",z, t);
        if(t!=undefined) {
          myString+="&lt;span style='color: "+t+"'&gt;"+z+"&lt;/span&gt;";
        } else {
          myString+=z;
        }
      }
      x[n].innerHTML=myString;
    }
  }
}
</code></pre>

CC BY-SA 3.0
2017-01-25T11:02:22.793Z
Wow, thanks for the detailed answer. I wonder if it's possible to do anything similar on a phone at all (via some kind of dirty hack at some level), or perhaps if colours are impossible would there be a way to add tone markers in black and white?
Flash
CC BY-SA 3.0
2017-01-25T14:01:47.263Z
A custom-made input method could definitely input tone marks (digits or others) when YOU type. However, doing what I did above, replacing previous messages, and messages by other people, with something else would be impossible. The other option would be to write from scratch a WeChat clone, compatible with WeChat. Good luck with that :-)
dda
CC BY-SA 3.0
2017-01-25T06:00:50.473Z
2018-03-25T11:51:54.523Z
2018-03-25T11:51:54.523Z
dda
<p>I use wechat to talk with Chinese friends, and try to type Chinese to help me learn. I would like Chinese characters to appear colour coded according to tone.</p>

<p>How could I go about this? Assuming it's not possible with any current product, how could one build an app or similar to achieve this? My phone is an iPhone 7 but also interested in Android.</p>

<tones><learning>
Colour code characters according to tone on iPhone/Android
# Colour code characters according to tone on iPhone/Android

(Asked by: username_0 on 2017-01-25)

I use wechat to talk with Chinese friends, and try to type Chinese to help me learn. I would like Chinese characters to appear colour coded according to tone.

How could I go about this? Assuming it's not possible with any current product, how could one build an app or similar to achieve this? My phone is an iPhone 7 but also interested in Android.

**Tags:** tones, learning


---

## 1 answers

### Answer by username_1 on 2017-01-25. Score: 3

This is not possible with existing products. You'd need a special input method, like [the Multiling Keyboard](https://play.google.com/store/apps/details?id=com.klye.ime.latin&hl=en), that would specifically format the input. There are a few difficulties with this:

* Many hanzi have multiple tones. Which one to pick? To be (possibly, but never 100%) accurate, you'd need a dictionary. Which means the input method would have to backtrack when the tone of the first character changes tone.
* WeChat doesn't allow colour formatting. So your new input method won't be able to colour the text anyway.

In WeChat's web interface, one might be able to develop a Chrome extension that reads all messages, and colours them. That wouldn't be ***that*** hard, but I expect it would be time consuming, and resource hungry.

EDIT

After giving it some thought, here is what I think would required:

* The [CEDICT](https://www.mdbg.net/chindict/chindict.php?page=cc-cedict) dictionary. Probably edited to fit a database.
* Alternatively, if you only care about character tones, a database based on [Unihan](http://unicode.org/charts/unihan.html).
* Some Javascript and jQuery to lookup the messages and color them.

Something like this [I am using Cantonese tones as I am much more comfortable with them]:

[![enter image description here](https://i.sstatic.net/OfxYx.png)](https://i.sstatic.net/OfxYx.png)

VERY COARSE CODE

```
var db={};
db["行"]=4;
db["有"]=5;
db["人"]=4;
db["嗎"]=3;

var myColors= new Array("nil", "#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#00FFFF", "#FF00FF");

for (n in x) {
  myString="";
  if(x.hasOwnProperty(n)) {
    if(x[n].innerText!=undefined) {
      s=x[n].innerText;
      console.log(n, s);
      j=s.length;
      for(i=0; i<j; i++) {
        z=s.charAt(i);
        t=myColors[db[z]];
        console.log(" .",z, t);
        if(t!=undefined) {
          myString+="<span style='color: "+t+"'>"+z+"</span>";
        } else {
          myString+=z;
        }
      }
      x[n].innerHTML=myString;
    }
  }
}

```

> **Comments:**
> **username_0**: Wow, thanks for the detailed answer. I wonder if it's possible to do anything similar on a phone at all (via some kind of dirty hack at some level), or perhaps if colours are impossible would there be a way to add tone markers in black and white?  
> **username_1**: A custom-made input method could definitely input tone marks (digits or others) when YOU type. However, doing what I did above, replacing previous messages, and messages by other people, with something else would be impossible. The other option would be to write from scratch a WeChat clone, compatible with WeChat. Good luck with that :-)  

---

