How are invariants represented in category theory? I'm trying to better understand how to think about invariance in the setting of category theory.
In some cases it seems there's an obvious interpretation: for instance, the fundamental group $\pi_1$ of a topological space is invariant (up to group isomorphism) with respect to mapping by basepoint-preserving homeomorphisms, which are the isomorphisms in the category Top• of topological spaces with distinguished base point and basepoint-preserving continuous maps.  Further, $\pi_1$ can be viewed as a functor from Top• to Grp, the category of groups and homomorphisms.  So here an invariant is encoded as a functor in a nice way.
What about less obvious examples?  Here are a few I've been thinking about:


*

*The Gauss-Bonnet theorem says that the total (Gaussian) curvature of a compact surface equals $2\pi\chi$, where $\chi$ is the Euler characteristic.  So total curvature is also invariant w.r.t. homeomorphism.  Of course, $\chi$ can be expressed in terms of the ranks of the homology groups, which are themselves functors, so this gives us a way to relate Gauss-Bonnet to categories and functors.  But is it possible in the language of category theory to specify that, more specifically, total curvature is an invariant?

*In classical mechanics, the symplectic form associated with a conservative system is preserved under the flow induced by the Hamiltonian of that system.  Categorically, (and actually, more generally) we can say that the symplectic form is preserved by symplectomorphisms, which are the isomorphisms in the category of symplectic manifolds.  But it is not obvious (to me) that the symplectic form can be viewed as a functor.

*Maybe this is a poor example, but distance in the vector space $\mathbb{R}^n$ is preserved by Euclidean transformations, i.e., maps in $E(n,\mathbb{R})$.  Does this fact have a description via categories and functors?


Finally, note that in the first two examples, the invariants metnioned are preserved under the isomorphisms of the associated category.  Does this generalize?  I.e., can we aways build a reasonable category (e.g., must be non-trivial) in which a given invariant is preserved by isomorphisms?
 A: The last question might be better phrased "can we always build a reasonable category where the morphisms that preserve the invariant are exactly the isomorphisms?".
And this is the process of localization of a category. It doesn't always work well, you need at least some commutativity or Ore assumption (just like when you are localizing rings).
The standard example that comes to my head is the derived category of an abelian category, which is obtained by formally inverting the morphisms in the homotopy category of chain complexes that yield isomorphisms under the homology functors.
But, just like for rings, localization can turn out to be the zero category.
A somehow "better" framework for localization questions might be model categories, but I guess that depends on what you want to do with that.
A: It seems to me that inevitably one has to do some categorification to answer this question.  For example, the cardinality of the fundamental group (if it is finite) is a topological invariant which is not a functor, but it ultimately "comes from" a functor.  The Euler characteristic example is similar.
The other two examples seem trivial.  The morphisms in each case are more or less defined by invariance under the given invariants, so I'm not sure this is at all in the same spirit as the fundamental group example.
The answer to your last question is also trivial, if I'm interpreting it correctly: specify that the only morphisms of the category are identity morphisms.
A: After considering the other answers, I believe the following definition is satisfactory:
Let $F$ be a functor from a category $C$ to a category $D$.  We say that $F$ is an invariant in $C$ if for any isomorphism $f:a \rightarrow b$ in $C$, $F(a)=F(b)$.
You may notice that such a definition yields obvious invariants in any category.  In particular, if the image of $C$ under $F$ is a subcategory consisting of a single object and its identity morphism, then the definition above is satisfied (and further, it is possible to construct such an $F$ for any $D$).  But that's ok: we can just admit that every category has trivial invariants and move on.
This definition of invariance certainly captures the important example of the fundamental group (with $C$=Top•, $D$=Grp, and $F=\pi_1$).  As for the invariants that "come from a functor": as long as there's a functional relationship between the objects in the target of the underlying functor and the values of the derived invariants, then you can simply rename the objects the target as necessary (not sure that buys you much, though!).
A: That seems like a perfectly reasonable definition.  In addition it admits an obvious (and quite useful) description of invariants in terms of higher category theory, where notions of homotopy are more readily generalized.  Think again of homology; it's homeomorphism invariant of course, but more importantly it's homotopy invariant.  First we describe homotopy in the context of 2 categories:
Let $C$ be a 2-category.  We call a 1-morphism $f:a \to b$ a $homotopy$ $equivalence$ if there exists a 1-morphism $g: b \to a$, and invertible 2-morphisms $\alpha : gf \to \textrm{id}_{a}$ and $\beta : fg \to \textrm{id}_{b}$.
Then we obtain the following definition:
Let $C, D$ be 2-categories, and let $F: C \to D$ be a 2-functor.  We say that $F$ is an $invariant$ if, for any homotopy equivalence $f : a \to b$, $F(a) = F(b)$.
This definition more efficiently captures the trait of invariance under homotopy equivalence.  If one wishes to (loosely) describe the "singular axiom", or invariance under weak equivalence, the above definition can be reformulated in terms of $\infty$-categories.
