# Is it possible to substitute one style with another via Stylesheet?

When thinking on the question

it crossed my mind that it may be possible to "intercept" one style ("Input") on the level of the Notebook's private stylesheet and replace it with definitions of another style ("Code") from the "Core.nb" stylesheet. Something like the following (it demonstrates the idea, but doesn't work):

Cell[StyleData["Input"], StyleData["Code", StyleDefinitions -> "Core.nb"]]]


The above line of code defines an "intercept" for the style "Input" on the level of the Notebook's private stylesheet. The second argument StyleData["Code", StyleDefinitions -> "Core.nb"] should "import" the complete definition for style "Code" from the "Core.nb" stylesheet, but it doesn't work as written. How should it be changed in order to achieve the desired goal?

Based on this answer by Carl Woll, the syntax should be:

Cell[StyleData["Input", StyleDefinitions -> StyleData["Code"]]]


Setting the option programmatically:

SetOptions[
EvaluationNotebook[],
StyleDefinitions -> Notebook[
{
Cell[StyleData[StyleDefinitions -> "Default.nb"]],
Cell[StyleData["Input", StyleDefinitions -> StyleData["Code"]]]
}
]
]


Checking:

As one can see, the input cell is formatted as a "Code" cell, while in its definition it still has the style "Input". Done!