Write text with negative color in tikz
The short answer is: use blend modes
(p.340, pgfmanual v3.0.1a) with difference
mode.
But, for better results, you may use outlined text or background with opacity. The following picture shows different tests:
\documentclass[tikz]{standalone}
\usepackage[outline]{contour}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node (a) {\includegraphics{tiger}};
\path (a.north) -- (a.south)
\foreach \pos in {1,...,7}{coordinate[pos=\pos/8] (p-\pos)};
\tikzset{my text/.style={text=white,font=\Huge\bfseries}}
\def\mytext{Test of long text}
\node[my text] (ex) at (p-1) {\mytext};
\node[anchor=east] at (ex -| a.west) {white text};
\node[my text,text=black](ex) at (p-2) {\mytext};
\node[anchor=east] at (ex -| a.west) {black text};
\node[my text,fill opacity=.5,fill=black,text opacity=1] (ex) at (p-3) {\mytext};
\node[anchor=east] at (ex -| a.west) {black background with opacity};
\node[my text,text=black,fill opacity=.5,fill=white,text opacity=1] (ex) at (p-4) {\mytext};
\node[anchor=east] at (ex -| a.west) {white background with opacity};
\node[my text] (ex) at (p-5) {\contour{white}{\mytext}};
\node[anchor=east] at (ex -| a.west) {white outlined text};
\node[my text] (ex) at (p-6) {\contour{black}{\textcolor{white}{\mytext}}};
\node[anchor=east] at (ex -| a.west) {black outlined text};
\begin{scope}[blend group=difference]
\clip ($(p-7 -| a.west) + (0,1.1em)$) rectangle ($(p-7 -| a.east) + (0,-1.1em)$);
\node {\includegraphics{tiger}};
\node[my text] (ex) at (p-7) {\mytext};
\end{scope}
\node[anchor=east] at (ex -| a.west) {\emph{required} blended text (difference)};
\end{tikzpicture}
\end{document}
A nonanswer : You are making a bad decision worse. First you don't need t=
prefix because they are all t values. If you remove that you have the option to put a corner box with solid background with designated four character long width and one character long height
\documentclass[tikz]{standalone}
\usepackage{mwe} % <- for dummy images
\begin{document}
\begin{tikzpicture}[
cornerbox/.style 2 args={
path picture={
\node{\includegraphics[width=1cm,height=1cm]{#1}};
\node[fill=black,text=white,
minimum width=3ex,minimum height=1ex,
anchor=north west,
outer sep=0,font=\sffamily\tiny]
at (path picture bounding box.north west) {#2};
},
inner sep=0,
minimum size=1cm
}
]
\node[cornerbox={example-image}{$\infty$},draw,thick] at (0,0) {};
\node[cornerbox={example-image-a}{200},draw,thick] at (1,0) {};
\node[cornerbox={example-image-b}{5000},draw,thick] at (2,0) {};
\end{tikzpicture}
\end{document}
Here you can make the annotation box as small as you wish, such that visually impaired and colorblinds can actually read your data.
Intriguing question, to which I don't know the answer. However, you can mimic this effect doing something like this:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usepackage{lipsum}
\newcommand\fadingtext[3][]{%
\begin{tikzfadingfrompicture}[name=fading letter]
\node[text=transparent!0,inner xsep=0pt,outer xsep=0pt,#1] {#3};
\end{tikzfadingfrompicture}%
\begin{tikzpicture}[baseline=(textnode.base)]
\node[inner sep=0pt,outer sep=0pt,#1](textnode){\phantom{#3}};
\shade[path fading=fading letter,#2,fit fading=false]
(textnode.south west) rectangle (textnode.north east);%
\end{tikzpicture}%
}
\begin{document}
\begin{tikzpicture}
\shade[left color=black,right color=red] (0,0) rectangle (4,2) (2,1) node{\fadingtext{left color=white, right color=yellow}{this text is easier to read}};
\end{tikzpicture}
\end{document}
(example based on another answer on this forum)