#UWP get system theme (Light/Dark) - windows

how to get windows system theme in UWP?
Light/Dark
var DefaultTheme = new Windows.UI.ViewManagement.UISettings();
WindowsThemeText.Text =DefaultTheme.UIElementColor(Windows.UI.ViewManagement.UIElementType.PageBackground).ToString();
i've tried that , but it doesnt shows theme....

uiTheme will return only two color #FF000000(Dark)or #FFFFFFFF (Light) according to system ui theme, so you can go this way.
you can fill dark or light color to your some ui element to show current system theme
var DefaultTheme = new Windows.UI.ViewManagement.UISettings();
var uiTheme = DefaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString();
if(uiTheme == "#FF000000")
{
WindowsThemeText.Text = "Dark";
}
else if(uiTheme == "#FFFFFFFF")
{
WindowsThemeText.Text = "Light";
}
/*
else
{
WindowsThemeText.Text = "Some new Updated theme found";
}
*/

Related

Wear OS Button Background

Button(
onClick = {
raceOn = !raceOn
if (raceOn) {
text.value = "Stop!"
color.value = Color.Red
} else {
text.value = "Go!"
color.value = Color.Green
}
},
modifier = Modifier.background(color = color.value),
content = {
Text(
text = "${text.value}",
)
}
)
Using the code above, I got the attached image. What I want is the inside of the button to be green and not the background behind it. I couldn't the right property to modify.
Has anyone here tried to modify the Button background? Or perhaps suggest another solution. I tried the OutlinedButton and wasn't successful.
Thanks!
Use the MaterialTheme ButtonColors.
val colors: ButtonColors = ButtonDefaults.primaryButtonColors(backgroundColor = Color.Red)
Button(onClick = { /*TODO*/ }, colors = ButtonDefaults.primaryButtonColors()) {
// TODO
}
You can also update via setting the MaterialTheme defaults.
val wearColorPalette: Colors = Colors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200,
secondaryVariant = Teal200,
error = Red400,
onPrimary = Color.Black,
onSecondary = Color.Black,
onError = Color.Black
)
...
MaterialTheme(
colors = wearColorPalette,
typography = Typography,
// For shapes, we generally recommend using the default Material Wear shapes which are
// optimized for round and non-round devices.
content = content
)

code highlighting apex (Firefox 31)

The Oracle Application Express code editor is just plain back text on white background. No Code highlighting. Also I can't press "tab" without the textfield loosing focus.
I am using firefox 31 (can't upgrade, rescricted by Admin at work here) Also I can't install plugins. I know you can change css on specific sites using a special folder in firefox ("chrome"-folder / userContent.css). I already used this to change die default size of the textfield, because it was frickin small everytime I opened the edit page.
So do you know any framework or script I can use in Apex ? (I could copy that shit to jsfiddle.net every time but that sucks
(I also found the scratchpad in Firefox, which can run js and jquery. Does that help ?)
[SOLVED]
since you can't use
<script src = "">
etc. in plain js, I had to use loadScript. For css files it was even more complicated, but I got it all working.
This is my code, I run it in scratchpad (firefox). It uses ACE to change a div to an editor with highlighting. When clicking apply I revert the editor-changes in the DOM but keep the text/code.
// Load Ace js
loadScript("http://cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js", function(){
//initialization code
});
// Load Ace css
var cssId = 'myCss'; // you could encode the css path itself to generate id..
if (!document.getElementById(cssId)){
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.id = cssId;
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.min.css';
link.media = 'all';
head.appendChild(link);
}
// change textarea to div
var editorRegion = document.getElementById('F4000_P4651_PLUG_SOURCE_fieldset');
editorRegion.innerHTML = editorRegion.innerHTML.replace("textarea","div");
// run ACE
highlight();
// Modify the apply Button in Apex to first revert ACE-Editor to normal, then do the usual apply.
var applyChanges = document.getElementById('B3456326662');
applyChanges.setAttribute("onclick","modifiedApply()");
function modifiedApply(){
close();
setTimeout(normalApply, 500);
}
function normalApply(){
javascript:apex.submit('Apply_Changes');
}
// Revert ACE-Changes, but keep changed text/code.
function close(){
var value = editor.getValue();
editor.destroy();
var oldDiv = editor.container;
var newDiv = oldDiv.cloneNode(false);
newDiv.textContent = value;
oldDiv.parentNode.replaceChild(newDiv, oldDiv);
newDiv.outerHTML = newDiv.outerHTML.replace("div","textarea");
var old_new_old = document.getElementById('F4000_P4651_PLUG_SOURCE');
old_new_old.textContent = old_new_old.textContent.substring(0, old_new_old.textContent.length - 6);
}
var editor;
function highlight() {
editor = ace.edit("F4000_P4651_PLUG_SOURCE");
editor.setTheme("ace/theme/monokai");
editor.getSession().setUseWorker(false);
editor.getSession().setMode("ace/mode/javascript");
document.getElementsByClassName('ace_print-margin')[0].setAttribute("style","left:1000px");
}
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function(){
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}

firefox add-on sdk ToggleButton badgeColor displayed default red color

when I resized the firefox window to just not display my add-on's toggleButton, then resized the firefox window to display my add-on's toggleButton. The badgeColor was displayed with default color(red).
How should I do and solve this problem? And is this the firefox's bug?
var {ToggleButton} = require("sdk/ui/button/toggle");
var button = ToggleButton({
id:"aaaa",
label:"aaaa",
icon:{
"16":"./aaaa-16.png",
"32":"./aaaa-32.png",
"64":"./aaaa-64.png",
},
onChange:changed,
badge:"0",
badgeColor:"#A9A9A9",
});
function changed(state) {
if (button.badge == "1") {
// code
button.badge = "0";
} else {
button.badge = "1";
}
if (state.checked) {
// code
button.badgeColor = "#20B2AA";
}
else {
button.badgeColor = "#A9A9A9";
}
}

Xamarin Forms Teechart - show only graph and labels

I have a steema teechart named tChart1 consisting of candles. I want to show only the candles and the labels of the bottom axis. Everything else should be transparent. I have been able to hide some of the things, but the background is still white and there are vertical lines (I assume the grid) still showing.
tChart1.Title.Visible = false;
tChart1.Walls.Visible = false;
tChart1.Axes.Left.Visible = false;
tChart1.Legend.Visible = false;
You need to hide or make transparent the following elements:
tChart1.Axes.Left.Grid.Visible = false;
tChart1.Axes.Bottom.Grid.Visible = false;
tChart1.Panel.Transparent = true;
tChart1.Panel.Gradient.Visible = false;
tChart1.Walls.Visible = false;
tChart1.Legend.Transparent = true;
Bottom axis labels font color should be changed like this:
tChart1.Axes.Bottom.Labels.Font.Color = Color.Blue;
Custom labels can be set like this:
private void AddCustomLabels()
{
tChart1.Axes.Left.Labels.Items.Clear();
(tChart1.Axes.Left.Labels.Items.Add(123,"Hello")).Font.Size=16;
(tChart1.Axes.Left.Labels.Items.Add(466,"Good\n\rbye")).Transparent=false;
tChart1.Axes.Left.Labels.Items.Add(300);
AxisLabelItem a = tChart1.Axes.Left.Labels.Items.Add(-100);
a.Transparent=false;
a.Color=Color.Blue;
a.Transparency=50;
}
Candle series pen:
candle1.Pen.Color = Color.Lime;

Android: How to end animation of a listitem using valueanimator?

I am using the ValueAnimator to make one row in my list pulse from dark blue to light blue finitely. However, I need to check for a boolean when the rows load and when it gets set to false I need the view to go back to its original non-pulsing state. What is the best way of doing this?
My code is as follows -
if(isHighlighted(post)) {
String titleText = title.getText().toString();
title.setText(titleText);
title.setTextColor(Color.WHITE);
timeStamp.setTextColor(Color.WHITE);
highLighterStartColor = resources.getColor( R.color.active_blue );
highLighterEndColor = resources.getColor( R.color.teal );
ValueAnimator va = ObjectAnimator.ofInt(view, "backgroundColor", highLighterStartColor, highLighterEndColor);
if(va != null) {
va.setDuration(750);
va.setEvaluator(new ArgbEvaluator());
va.setRepeatCount(ValueAnimator.INFINITE);
va.setRepeatMode(ValueAnimator.REVERSE);
va.start();
}
} else {
title.setTextAppearance(activity.getApplicationContext(), R.style.medium_text);
timeStamp.setTextAppearance(activity.getApplicationContext(), R.style.timestamp_text);
}

Resources