Custom Theme Creation
JoseZamora97 opened this issue · comments
Jose Zamora commented
Hi!,
I am trying to create a custom theme from DEFAULT theme but nothing changes.
This is my method that sets the codeview up.
public void setUpCodeView() {
codeView = findViewById(R.id.code_view);
int colorAccent = getResources().getColor(R.color.colorAccent);
int colorPrimary = getResources().getColor(R.color.colorPrimary);
int colorPrimaryDark = getResources().getColor(R.color.colorPrimaryDark);
int colorTitles= getResources().getColor(R.color.colorTitles);
int colorBodies= getResources().getColor(R.color.colorBodies);
SyntaxColors syntaxColors = new SyntaxColors(
colorAccent, colorAccent, colorBodies, colorPrimaryDark,
colorTitles, colorTitles, colorBodies, colorBodies,
colorTitles, colorTitles, colorBodies
);
ColorThemeData myTheme = ColorTheme.DEFAULT.theme()
.withSyntaxColors(syntaxColors);
codeView.setOptions(Options.Default.get(this)
.withTheme(myTheme)
.withFont(Objects.requireNonNull(ResourcesCompat.getFont(this,
R.font.nunito))));
}
And this is the line where I set code to the codeView
codeView.setCode(myText, "py");
The text appears but there is no code highlight and theme doesnt change.
Ty for help!.