Source:
public static int getThemeForService(final Context context, final int serviceId) { final Resources res = context.getResources(); final String lightTheme = res.getString(R.string.light_theme_key); final String darkTheme = res.getString(R.string.dark_theme_key); final String blackTheme = res.getString(R.string.black_theme_key); final String deviceDarkTheme = res.getString(R.string.device_dark_theme_key); final String deviceBlackTheme = res.getString(R.string.device_black_theme_key); final String selectedTheme = getSelectedThemeString(context); int defaultTheme = R.style.DarkTheme; if (selectedTheme.equals(lightTheme)) { defaultTheme = R.style.LightTheme; } else if (selectedTheme.equals(blackTheme)) { defaultTheme = R.style.BlackTheme; } else if (selectedTheme.equals(darkTheme)) { defaultTheme = R.style.DarkTheme; } else if (selectedTheme.equals(deviceDarkTheme)) { if (getDeviceTheme(context)) { defaultTheme = R.style.DarkTheme; } else { defaultTheme = R.style.LightTheme; } } else if (selectedTheme.equals(deviceBlackTheme)) { if (getDeviceTheme(context)) { defaultTheme = R.style.BlackTheme; } else { defaultTheme = R.style.LightTheme; } } if (serviceId <= -1) { return defaultTheme; } final StreamingService service; try { service = NewPipe.getService(serviceId); } catch (ExtractionException ignored) { return defaultTheme; } String themeName = "DarkTheme"; if (defaultTheme == R.style.LightTheme) { themeName = "LightTheme"; } else if (defaultTheme == R.style.BlackTheme) { themeName = "BlackTheme"; } else if (defaultTheme == R.style.DarkTheme) { themeName = "DarkTheme"; } themeName += "." + service.getServiceInfo().getName(); int resourceId = context .getResources() .getIdentifier(themeName, "style", context.getPackageName()); if (resourceId > 0) { return resourceId; } return defaultTheme; }

Target:
public static int getThemeForService(final Context context, final int serviceId) { final Resources res = context.getResources(); final String lightTheme = res.getString(R.string.light_theme_key); final String darkTheme = res.getString(R.string.dark_theme_key); final String blackTheme = res.getString(R.string.black_theme_key); final String automaticDeviceTheme = res.getString(R.string.auto_device_theme_key); final String selectedTheme = getSelectedThemeString(context); int defaultTheme = R.style.DarkTheme; if (selectedTheme.equals(lightTheme)) { defaultTheme = R.style.LightTheme; } else if (selectedTheme.equals(blackTheme)) { defaultTheme = R.style.BlackTheme; } else if (selectedTheme.equals(automaticDeviceTheme)) { if (isDeviceDarkThemeEnabled(context)) { final String selectedNightTheme = getSelectedNightThemeString(context); if (selectedNightTheme.equals(blackTheme)) { defaultTheme = R.style.BlackTheme; } else { defaultTheme = R.style.DarkTheme; } } else { defaultTheme = R.style.LightTheme; } } if (serviceId <= -1) { return defaultTheme; } final StreamingService service; try { service = NewPipe.getService(serviceId); } catch (final ExtractionException ignored) { return defaultTheme; } String themeName = "DarkTheme"; if (defaultTheme == R.style.LightTheme) { themeName = "LightTheme"; } else if (defaultTheme == R.style.BlackTheme) { themeName = "BlackTheme"; } themeName += "." + service.getServiceInfo().getName(); final int resourceId = context .getResources() .getIdentifier(themeName, "style", context.getPackageName()); if (resourceId > 0) { return resourceId; } return defaultTheme; }