Triplet losses are defined in terms of the contrast between three inputs. Each of the inputs has an associated class label, and the goal is to map all inputs of the same class to the same point, while all inputs from other classes are mapped to different points some distance away. It's called a triplet because the loss is computed using an anchor, a sample belonging to the same class as the anchor, and a sample belonging to a different class.
The goal of triplet loss is to find an embedding such that $$ \left\lVert f(x^a_i) - f(x^p_i) \right\rVert_2^2+\alpha < \left\lVert f(x_i^a)-f(x_i^n)\right\rVert_2^2 \forall \left(f(x_i^a),f(x_i^p),f(x_i^n)\right)\in\mathcal{T} \tag{*} $$ where $\mathcal{T}$ is the set of all possible triplets. A triplet is composed of an anchor point, a positive point (same class as the anchor), and a negative point (distinct class from the anchor).
Clearly, iterating over all possible triplets becomes enormously expensive when the data set is even moderately sized. Therefore, it's common to carefully choose which triplets to use when computing the loss. This means that instead of $\mathcal{T}$, training proceeds on some well-chosen $\mathcal{S} \subset \mathcal{T}$
The loss is zero when the inequality $(*)$ holds, and becomes larger the more that this inequality is violated, giving us the loss function
$$L = \sum_{i\in \mathcal{S}} \max \left \{ 0, \lVert f(x^a_i) - f(x^p_i) \rVert_2^2 - \lVert f(x^a_i) - f(x^n_i) \rVert_2^2 +\alpha \right\} $$