If your terminal implements xterm's OSC 10 and OSC 11 as indicated in the question, then it probably also implements OSC 4:
Ps = 4 ; c ; spec ⇒ Change Color Number c to the color
specified by spec.
For example
print "\033]4;1;green\007";
print "\033]4;1;green\033\\";
using green to replace color 1 (red) where xterm also would accept an RGB setting:
/*
* Set or query entries in the Acolors[] array by parsing pairs of color/name
* values from the given buffer.
*
* The color can be any legal index into Acolors[], which consists of the
* 16/88/256 "ANSI" colors, followed by special color values for the various
* colorXX resources. The indices for the special color values are not
* simple to work with, so an alternative is to use the calls which pass in
* 'first' set to the beginning of those indices.
*
* If the name is "?", report to the host the current value for the color.
*/
The legal values for spec are determined by XParseColor
(in xterm -- for other terminals, that is implementation-dependent and generally undocumented, making that aspect off-topic).