add get_colors function

This commit is contained in:
Evgeny
2021-09-01 07:50:17 +03:00
parent 2c2f11d52a
commit a1b6f73221
9 changed files with 35 additions and 20 deletions

View File

@@ -4,10 +4,10 @@
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
-- version = "1.0"
equals = "<font color=\""..ui:get_secondary_text_color().."\"> = </font>"
equals = "<font color=\""..ui:get_color().secondary_text.."\"> = </font>"
function on_alarm()
http:get("https://api.blockchain.info/ticker")
http:get("https://api.blockchain.info/ticker")
end
function on_network_result(result)

View File

@@ -8,7 +8,7 @@
local json = require "json"
local color = require "md_colors"
local text_color = ui:get_secondary_text_color()
local text_color = ui:get_colors().secondary_text
local equals = "<font color=\""..text_color.."\"> = </font>"
-- константы --

View File

@@ -8,13 +8,13 @@
local joke = ""
local txt = ""
function urlencode(str)
if (str) then
function urlencode(str)
if (str) then
str = string.gsub(str, "\n", "\r\n")
str = string.gsub(str, "([^%w _ %- . ~])", function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub(str, " ", "+")
end
return str
str = string.gsub(str, " ", "+")
end
return str
end
function urldecode(str)
@@ -24,12 +24,12 @@ function urldecode(str)
end
function on_alarm()
http:get("http://api.icndb.com/jokes/random")
http:get("http://api.icndb.com/jokes/random")
end
function on_network_result(result)
local first_letter = string.sub(result, 1, 1)
local textColor = ui:get_secondary_text_color()
local textColor = ui:get_colors().secondary_text
joke = ajson:get_value(result, "object object:value string:joke")
local id = ajson:get_value(result, "object object:value string:id")