How does roundcube color the emails and how to implement the roundcube color scheme in Delphi?

StackOverflow https://stackoverflow.com/questions/22986796

  •  01-07-2023
  •  | 
  •  

Question

RoundCube gives a nice color scheme for the plain-text email below.

I am wondering how does RoundCube do this, and how to implement this color scheme in Delphi ?

>>>> Peter says: 
>>>> Peter says: 
>>> Jane says:
>>> Jane says:
>> Peter says: 
>> Peter says:
> Jane says:
> Jane says:
Peter says: 
Peter says: 

roundcube

Was it helpful?

Solution

I have no idea how RoundCube does it; I'm not familiar with the product. The effect is straightforward to achieve with HTML and CSS, though.

I used nested blockquote elements for the e-mail quotes:

<blockquote>
  <blockquote>
    <blockquote>
      <blockquote>
        <blockquote>
          <blockquote>
            Peter says:<br/>
            Peter says:
          </blockquote>
          Jane says:<br/>
          Jane says:
        </blockquote>
        Peter says:<br/>
        Peter says:
      </blockquote>
      Jane says:<br/>
      Jane says:
    </blockquote>
    Peter says:<br/>
    Peter says
  </blockquote>
  Jane says:<br/>
  Jane says:
</blockquote>
Peter says:</br>
Peter says:

Then I colored the borders and text according to the nesting level in CSS:

body {
  font-family: 'Times';
}
blockquote {
  background-color: #eee;
  border-left: 3px solid #00f;
  border-right: 3px solid #00f;
  color: #00f;
  padding: 0.6em 0.9em 0.3em;
  margin: 0 0 0.3em;
}
blockquote > blockquote {
  color: #0f0;
  border-color: #0f0;
}
blockquote > blockquote > blockquote {
  color: #b22;
  border-color: #b22;
}

You can look at a live demo.

RoundCube is a Web e-mail program, so you could look at the HTML it generates, if you wanted to confirm this is how it works.

The hardest part about the task would be parsing the e-mail to identify blocks of text from the same level, but that's beyond the scope of this question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top