execCommand('forecolor') with RGB values is resulting in unexpected colors

Confirmed Issue #12855917 • Assigned to Kris K.


Wei K.
Jul 20, 2017
This issue is public.
Found in
  • Microsoft Edge
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

document.execCommand('forecolor', false' …) is not producing the right colors when an "rgb(…)" value is being passed in.

For example,
document.execCommand('forecolor',false, '#ff0000') is resulting in #ff0000 applied.
document.execCommand('forecolor',false, 'rgb(0,0,0)') is resulting in #b00000 applied.
document.execCommand('backcolor',false, 'rgb(255,0,0)') works as expected, #ff0000 applied to background.

See attached document for repro.

Highlight part of the sample text, then click the first button and unselect the text; it should have changed. Repeat for next button and last button.


1 attachment

Comments and activity

  • Hello,

    Thank you for providing this information about the issue. Unfortunately, we are unable to reproduce this problem in Edge with the information at hand. Please attach the repro document.

    Best Wishes,
    The MS Edge Team

  • Microsoft Edge Team

    Changed Assigned To to “James M.”

  • James, see the attached file.

  • Hello,

    Thank you for providing this information about the issue. We are unable to reproduce the problem and find your sample exhibits no behavior in any browsers. You may need to enable DesignMode via script and additionally check your repro for typos (RedRGB is not 0,0,0). Please update this case with a new sample and include the version of Edge.

    Best Wishes,
    The MS Edge Team

  • Apologies for the mistake. Please see index3.html which has DesignMode enabled via script, and rgb(255,0,0). The repro is still consistent, and I verified that the same html works with chrome. I am getting back the hexadecimal value #002500 applied instead of #ff0000.

    I confirmed the repro on the following versions of edge:
    Microsoft Edge 41.16241.1001.0
    Microsoft Edge 40.15063.0.0

  • Microsoft Edge Team

    Changed Steps to Reproduce

    Changed Assigned To to “Travis L.”

    Changed Status to “Confirmed”

    Changed Assigned To from “Travis L.” to “Kris K.”

  • Hello!
    I have a similar issue.

    execCommand('ForeColor’, false, 'rgba(0, 255, 0, 1.0)')

    is turning to


    Microsoft Edge 44.17763.1.0
    Microsoft EdgeHTML 18.17763

    I checked this problem in other browsers - it works fine. Any updates about it?

    is turning to color="#ba2501"

You need to sign in to your Microsoft account to add a comment.

Sign in